test: Write tests for upgradewallet RPC #18767

issue MarcoFalke openend this issue on April 25, 2020
  1. MarcoFalke commented at 5:23 pm on April 25, 2020: member

    Now that #15761 has been merged, it would be nice to have tests for it. They can be written by copying the file ./test/functional/feature_backwards_compatibility.py and modifying it to create a wallet with an older version, then check that it can be upgraded with a new version.

    Useful skills:

    Experience with the Bitcoin Core wallet and functional test suite.

    Want to work on this issue?

    The purpose of the good first issue label is to highlight which issues are suitable for a new contributor without a deep understanding of the codebase.

    You do not need to request permission to start working on this. You are encouraged to comment on the issue if you are planning to work on it. This will help other contributors monitor which issues are actively being addressed and is also an effective way to request assistance if and when you need it.

    For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.

  2. MarcoFalke added the label good first issue on Apr 25, 2020
  3. brakmic commented at 5:35 pm on April 25, 2020: contributor
    Will look into it.
  4. brakmic commented at 11:13 am on April 26, 2020: contributor

    Hi @MarcoFalke

    Well, after having played ping pong with the test framework for a while, I came to this solution, that, in my opinion, is nothing but an ugly hack.

    As I couldn’t use older binaries to run test nodes (the docs are clear about that) I saw no other option than to manually setup and run a v0.16.3 node, that I needed to create an older wallet.

    Not sure, if I should open a PR at all. Maybe only as draft for now?

    Regards,

  5. MarcoFalke commented at 11:40 am on April 26, 2020: member
    What are the issues you are seeing when running a 0.16 node with the test framework. Maybe they can be solved?
  6. brakmic commented at 11:46 am on April 26, 2020: contributor

    What are the issues you are seeing when running a 0.16 node with the test framework. Maybe they can be solved?

    It simply doesn’t start the node. Although I’ve downloaded the v0.16.3 binaries and configured them similarly to those from ./test/functional/feature_backwards_compatibility.py the framework can’t start them. The error gets thrown in test_node.py’s wait_for_rpcconnection. Usually, it should be able to call rpc.blockcount from there, but as it can’t create a proper RPC connection there is no way to continue test.

    So I did it manually.

  7. MarcoFalke commented at 11:48 am on April 26, 2020: member
    What is the log (combined_log.py) ?
  8. brakmic commented at 11:58 am on April 26, 2020: contributor

    What is the log (combined_log.py) ?

    I have included the previous entries to my current test.

    0self.add_nodes(self.num_nodes, extra_args=self.extra_args, versions=[
    1            None,
    2            160300,
    3        ], binary=[
    4            self.options.bitcoind,
    5            releases_path + "/v0.16.3/bin/bitcoind",
    6        ], binary_cli=[
    7            self.options.bitcoincli,
    8            releases_path + "/v0.16.3/bin/bitcoin-cli",
    9        ])
    

    Then I have started the test (so it tries to run v0.16.3 the same way it does with newer version).

    This is the combined_logs.py output.

      0./test/functional/combine_logs.py                                               (1) (1m 2s 828ms)  1Opening latest test directory: /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7
      2 node1                                    2020-04-26 11:56:40.815959  
      3                                   2020-04-26 11:56:40.819755 Bitcoin Core version v0.16.3 (release build)
      4                                   2020-04-26 11:56:40.819802 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
      5                                   2020-04-26 11:56:40.819845 Validating signatures for all blocks.
      6                                   2020-04-26 11:56:40.819864 Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000000000000
      7                                   2020-04-26 11:56:40.821144 Using the 'sse4' SHA256 implementation
      8                                   2020-04-26 11:56:40.821166 Using RdRand as an additional entropy source
      9                                   2020-04-26 11:56:40.843335 Default data directory /Users/brakmic/Library/Application Support/Bitcoin
     10                                   2020-04-26 11:56:40.843386 Using data directory /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest
     11                                   2020-04-26 11:56:40.843422 Using config file /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/bitcoin.conf
     12                                   2020-04-26 11:56:40.843460 Using at most 125 automatic connections (8192 file descriptors available)
     13                                   2020-04-26 11:56:40.852177 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
     14                                   2020-04-26 11:56:40.862566 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
     15                                   2020-04-26 11:56:40.862634 Using 2 threads for script verification
     16                                   2020-04-26 11:56:40.862728 scheduler thread start
     17                                   2020-04-26 11:56:40.864468 Allowing HTTP connections from: 127.0.0.0/8 ::1/128 
     18                                   2020-04-26 11:56:40.866260 Binding RPC on address ::1 port 18443
     19                                   2020-04-26 11:56:40.872933 Binding RPC on address 127.0.0.1 port 18443
     20                                   2020-04-26 11:56:40.873025 Initialized HTTP server
     21                                   2020-04-26 11:56:40.873054 HTTP: creating work queue of depth 16
     22                                   2020-04-26 11:56:40.873075 Starting RPC
     23                                   2020-04-26 11:56:40.873113 Starting HTTP RPC server
     24                                   2020-04-26 11:56:40.873134 No rpcpassword set - using random cookie authentication
     25                                   2020-04-26 11:56:40.873470 Generated RPC authentication cookie /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/.cookie
     26                                   2020-04-26 11:56:40.873508 Registering HTTP handler for / (exactmatch 1)
     27                                   2020-04-26 11:56:40.873532 Registering HTTP handler for /wallet/ (exactmatch 0)
     28                                   2020-04-26 11:56:40.873558 Starting HTTP server
     29                                   2020-04-26 11:56:40.873578 HTTP: starting 4 worker threads
     30                                   2020-04-26 11:56:40.873642 Entering http event loop
     31                                   2020-04-26 11:56:40.873704 Using wallet directory /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/wallets
     32                                   2020-04-26 11:56:40.873771 init message: Verifying wallet(s)...
     33                                   2020-04-26 11:56:40.873912 Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
     34                                   2020-04-26 11:56:40.873942 Using wallet wallet.dat
     35                                   2020-04-26 11:56:40.874210 CDBEnv::Open: LogDir=/var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/wallets/database ErrorFile=/var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/wallets/db.log
     36                                   2020-04-26 11:56:40.895366 net: setting try another outbound peer=false
     37                                   2020-04-26 11:56:40.896207 Cache configuration:
     38                                   2020-04-26 11:56:40.896253 * Using 2.0MiB for block index database
     39                                   2020-04-26 11:56:40.896277 * Using 8.0MiB for chain state database
     40                                   2020-04-26 11:56:40.896298 * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
     41                                   2020-04-26 11:56:40.896320 init message: Loading block index...
     42                                   2020-04-26 11:56:40.897008 Opening LevelDB in /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/blocks/index
     43                                   2020-04-26 11:56:40.944595 Opened LevelDB successfully
     44                                   2020-04-26 11:56:40.944751 Using obfuscation key for /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/blocks/index: 0000000000000000
     45                                   2020-04-26 11:56:40.945289 LoadBlockIndexDB: last block file = 0
     46                                   2020-04-26 11:56:40.945415 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
     47                                   2020-04-26 11:56:40.945462 Checking all blk files are present...
     48                                   2020-04-26 11:56:40.945520 LoadBlockIndexDB: transaction index disabled
     49                                   2020-04-26 11:56:40.945639 Initializing databases...
     50                                   2020-04-26 11:56:40.946150 Pre-allocating up to position 0x1000000 in blk00000.dat
     51                                   2020-04-26 11:56:40.976107 Opening LevelDB in /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/chainstate
     52                                   2020-04-26 11:56:41.016356 Opened LevelDB successfully
     53                                   2020-04-26 11:56:41.016502 Wrote new obfuscate key for /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/chainstate: 213f82d42b179542
     54                                   2020-04-26 11:56:41.016540 Using obfuscation key for /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/chainstate: 213f82d42b179542
     55                                   2020-04-26 11:56:41.016606 init message: Rewinding blocks...
     56                                   2020-04-26 11:56:41.016642  block index             120ms
     57                                   2020-04-26 11:56:41.016708 init message: Loading wallet...
     58                                   2020-04-26 11:56:41.143143 nFileVersion = 160300
     59                                   2020-04-26 11:56:41.144104 Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total
     60                                   2020-04-26 11:56:41.230872 Performing wallet upgrade to 60000
     61                                   2020-04-26 11:56:43.095054 keypool added 2000 keys (1000 internal), size=2000 (1000 internal)
     62                                   2020-04-26 11:56:43.186474  wallet                 2170ms
     63                                   2020-04-26 11:56:43.186784 setKeyPool.size() = 2000
     64                                   2020-04-26 11:56:43.186842 mapWallet.size() = 0
     65                                   2020-04-26 11:56:43.186881 mapAddressBook.size() = 0
     66                                   2020-04-26 11:56:43.187518   - Load block from disk: 0.23ms [0.00s]
     67                                   2020-04-26 11:56:43.188005   - Connect total: 0.48ms [0.00s (infms/blk)]
     68                                   2020-04-26 11:56:43.188089   - Flush: 0.10ms [0.00s (infms/blk)]
     69                                   2020-04-26 11:56:43.188154   - Writing chainstate: 0.07ms [0.00s (infms/blk)]
     70                                   2020-04-26 11:56:43.188256 UpdateTip: new best=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 height=0 version=0x00000001 log2_work=1 tx=1 date='2011-02-02 23:16:42' progress=1.000000 cache=0.0MiB(0txo)
     71                                   2020-04-26 11:56:43.188320   - Connect postprocess: 0.17ms [0.00s (infms/blk)]
     72                                   2020-04-26 11:56:43.188360 - Connect block: 1.04ms [0.00s (infms/blk)]
     73                                   2020-04-26 11:56:43.188410 Checking mempool with 0 transactions and 0 inputs
     74                                   2020-04-26 11:56:43.188554 mapBlockIndex.size() = 1
     75                                   2020-04-26 11:56:43.188629 Failed to open mempool file from disk. Continuing anyway.
     76                                   2020-04-26 11:56:43.188697 nBestHeight = 0
     77                                   2020-04-26 11:56:43.188944 torcontrol thread start
     78                                   2020-04-26 11:56:43.189144 Bound to [::]:18444
     79                                   2020-04-26 11:56:43.189301 Bound to 0.0.0.0:18444
     80                                   2020-04-26 11:56:43.189389 init message: Loading P2P addresses...
     81                                   2020-04-26 11:56:43.189446 tor: Error connecting to Tor control socket
     82                                   2020-04-26 11:56:43.189495 ERROR: DeserializeFileDB: Failed to open file /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/peers.dat
     83                                   2020-04-26 11:56:43.189547 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
     84                                   2020-04-26 11:56:43.189646 Invalid or missing peers.dat; recreating
     85                                   2020-04-26 11:56:43.202629 Flushed 0 addresses to peers.dat  13ms
     86                                   2020-04-26 11:56:43.202713 init message: Loading banlist...
     87                                   2020-04-26 11:56:43.202816 ERROR: DeserializeFileDB: Failed to open file /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/banlist.dat
     88                                   2020-04-26 11:56:43.202860 Invalid or missing banlist.dat; recreating
     89                                   2020-04-26 11:56:43.218546 Flushed 0 banned node ips/subnets to banlist.dat  16ms
     90                                   2020-04-26 11:56:43.218631 init message: Starting network threads...
     91                                   2020-04-26 11:56:43.218829 net thread start
     92                                   2020-04-26 11:56:43.218835 addcon thread start
     93                                   2020-04-26 11:56:43.218957 msghand thread start
     94                                   2020-04-26 11:56:43.218879 opencon thread start
     95                                   2020-04-26 11:56:43.218931 dnsseed thread start
     96                                   2020-04-26 11:56:43.218862 init message: Done loading
     97                                   2020-04-26 11:56:43.219106 Loading addresses from DNS seeds (could take a while)
     98                                   2020-04-26 11:56:43.219154 0 addresses found from DNS seeds
     99                                   2020-04-26 11:56:43.219195 dnsseed thread exit
    100                                   2020-04-26 11:56:44.190918 tor: Error connecting to Tor control socket
    101                                   2020-04-26 11:56:44.191008 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    102                                   2020-04-26 11:56:45.230628 Flushing wallet.dat
    103                                   2020-04-26 11:56:45.279563 Flushed wallet.dat 49ms
    104                                   2020-04-26 11:56:45.693318 tor: Error connecting to Tor control socket
    105                                   2020-04-26 11:56:45.693431 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    106                                   2020-04-26 11:56:47.948601 tor: Error connecting to Tor control socket
    107                                   2020-04-26 11:56:47.948716 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    108                                   2020-04-26 11:56:51.328746 tor: Error connecting to Tor control socket
    109                                   2020-04-26 11:56:51.328855 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    110                                   2020-04-26 11:56:56.391857 tor: Error connecting to Tor control socket
    111                                   2020-04-26 11:56:56.393227 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    112                                   2020-04-26 11:57:03.989212 tor: Error connecting to Tor control socket
    113                                   2020-04-26 11:57:03.990166 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    114                                   2020-04-26 11:57:15.386022 tor: Error connecting to Tor control socket
    115                                   2020-04-26 11:57:15.387224 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    116                                   2020-04-26 11:57:32.475315 tor: Error connecting to Tor control socket
    117                                   2020-04-26 11:57:32.480111 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    118 test  2020-04-26T11:56:40.774000Z TestFramework (DEBUG): PRNG seed is: 5125992667073647060 
    119 test  2020-04-26T11:56:40.775000Z TestFramework (DEBUG): Setting up network thread 
    120 test  2020-04-26T11:56:40.776000Z TestFramework (INFO): Initializing test directory /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7 
    121 test  2020-04-26T11:56:40.783000Z TestFramework.node0 (DEBUG): bitcoind started, waiting for RPC to come up 
    122 test  2020-04-26T11:56:40.791000Z TestFramework.node1 (DEBUG): bitcoind started, waiting for RPC to come up 
    123 node0 2020-04-26T11:56:40.923809Z [init] Bitcoin Core version v0.20.99.0-65276c773-dirty (release build) 
    124 node0 2020-04-26T11:56:40.923848Z [init] InitParameterInteraction: parameter interaction: -bind set -> setting -listen=1 
    125 node0 2020-04-26T11:56:40.924194Z [init] Validating signatures for all blocks. 
    126 node0 2020-04-26T11:56:40.924216Z [init] Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000000000000 
    127 node0 2020-04-26T11:56:40.928347Z [init] Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation 
    128 node0 2020-04-26T11:56:40.928406Z [init] Using RdSeed as additional entropy source 
    129 node0 2020-04-26T11:56:40.928435Z [init] Using RdRand as an additional entropy source 
    130 node0 2020-04-26T11:56:40.982665Z [init] Default data directory /Users/brakmic/Library/Application Support/Bitcoin 
    131 node0 2020-04-26T11:56:40.982703Z [init] Using data directory /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest 
    132 node0 2020-04-26T11:56:40.982761Z [init] Config file: /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/bitcoin.conf 
    133 node0 2020-04-26T11:56:40.982807Z [init] Config file arg: regtest="1" 
    134 node0 2020-04-26T11:56:40.982837Z [init] Config file arg: [regtest] bind="127.0.0.1" 
    135 node0 2020-04-26T11:56:40.982863Z [init] Config file arg: [regtest] discover="0" 
    136 node0 2020-04-26T11:56:40.982888Z [init] Config file arg: [regtest] dnsseed="0" 
    137 node0 2020-04-26T11:56:40.982913Z [init] Config file arg: [regtest] fallbackfee="0.0002" 
    138 node0 2020-04-26T11:56:40.982938Z [init] Config file arg: [regtest] keypool="1" 
    139 node0 2020-04-26T11:56:40.982962Z [init] Config file arg: [regtest] listenonion="0" 
    140 node0 2020-04-26T11:56:40.982986Z [init] Config file arg: [regtest] port="11794" 
    141 node0 2020-04-26T11:56:40.983010Z [init] Config file arg: [regtest] printtoconsole="0" 
    142 node0 2020-04-26T11:56:40.983037Z [init] Config file arg: [regtest] rpcport="16794" 
    143 node0 2020-04-26T11:56:40.983063Z [init] Config file arg: [regtest] server="1" 
    144 node0 2020-04-26T11:56:40.983089Z [init] Config file arg: [regtest] shrinkdebugfile="0" 
    145 node0 2020-04-26T11:56:40.983113Z [init] Config file arg: [regtest] upnp="0" 
    146 node0 2020-04-26T11:56:40.983137Z [init] Command-line arg: addresstype="bech32" 
    147 node0 2020-04-26T11:56:40.983166Z [init] Command-line arg: datadir="/var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0" 
    148 node0 2020-04-26T11:56:40.983191Z [init] Command-line arg: debug="" 
    149 node0 2020-04-26T11:56:40.983216Z [init] Command-line arg: debugexclude="libevent" 
    150 node0 2020-04-26T11:56:40.983240Z [init] Command-line arg: debugexclude="leveldb" 
    151 node0 2020-04-26T11:56:40.983265Z [init] Command-line arg: logthreadnames="" 
    152 node0 2020-04-26T11:56:40.983288Z [init] Command-line arg: logtimemicros="" 
    153 node0 2020-04-26T11:56:40.983313Z [init] Command-line arg: uacomment="testnode0" 
    154 node0 2020-04-26T11:56:40.983343Z [init] Using at most 125 automatic connections (8192 file descriptors available) 
    155 node0 2020-04-26T11:56:40.994110Z [init] Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements 
    156 node0 2020-04-26T11:56:41.003876Z [init] Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements 
    157 node0 2020-04-26T11:56:41.003957Z [init] Script verification uses 3 additional threads 
    158 node0 2020-04-26T11:56:41.004165Z [scheduler] scheduler thread start 
    159 node0 2020-04-26T11:56:41.004744Z [init] Allowing HTTP connections from: 127.0.0.0/8 ::1/128 
    160 node0 2020-04-26T11:56:41.005055Z [init] Binding RPC on address ::1 port 16794 
    161 node0 2020-04-26T11:56:41.008333Z [init] Binding RPC on address 127.0.0.1 port 16794 
    162 node0 2020-04-26T11:56:41.008428Z [init] Initialized HTTP server 
    163 node0 2020-04-26T11:56:41.008453Z [init] HTTP: creating work queue of depth 16 
    164 node0 2020-04-26T11:56:41.008475Z [init] Starting RPC 
    165 node0 2020-04-26T11:56:41.008506Z [init] Starting HTTP RPC server 
    166 node0 2020-04-26T11:56:41.008521Z [init] No rpcpassword set - using random cookie authentication. 
    167 node0 2020-04-26T11:56:41.008943Z [init] Generated RPC authentication cookie /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/.cookie 
    168 node0 2020-04-26T11:56:41.008971Z [init] Registering HTTP handler for / (exactmatch 1) 
    169 node0 2020-04-26T11:56:41.008989Z [init] Registering HTTP handler for /wallet/ (exactmatch 0) 
    170 node0 2020-04-26T11:56:41.009025Z [init] Starting HTTP server 
    171 node0 2020-04-26T11:56:41.009037Z [init] HTTP: starting 4 worker threads 
    172 node0 2020-04-26T11:56:41.009117Z [http] Entering http event loop 
    173 node0 2020-04-26T11:56:41.009166Z [init] Using wallet directory /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/wallets 
    174 node0 2020-04-26T11:56:41.009196Z [init] init message: Verifying wallet(s)... 
    175 node0 2020-04-26T11:56:41.009354Z [init] Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010) 
    176 node0 2020-04-26T11:56:41.009370Z [init] Using wallet /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/wallets 
    177 node0 2020-04-26T11:56:41.009605Z [init] BerkeleyEnvironment::Open: LogDir=/var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/wallets/database ErrorFile=/var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/wallets/db.log 
    178 node0 2020-04-26T11:56:41.078384Z [init] init message: Loading banlist... 
    179 node0 2020-04-26T11:56:41.078448Z [init] ERROR: DeserializeFileDB: Failed to open file /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/banlist.dat 
    180 node0 2020-04-26T11:56:41.078463Z [init] Invalid or missing banlist.dat; recreating 
    181 node0 2020-04-26T11:56:41.080432Z [http] Received a POST request for / from 127.0.0.1:55700 
    182 node0 2020-04-26T11:56:41.080535Z [httpworker.0] ThreadRPCServer method=getblockcount user=__cookie__ 
    183 node0 2020-04-26T11:56:41.098750Z [init] Flushed 0 banned node ips/subnets to banlist.dat  20ms 
    184 node0 2020-04-26T11:56:41.099105Z [init] net: setting try another outbound peer=false 
    185 node0 2020-04-26T11:56:41.105230Z [init] Using /16 prefix for IP bucketing 
    186 node0 2020-04-26T11:56:41.105288Z [init] Cache configuration: 
    187 node0 2020-04-26T11:56:41.105369Z [init] * Using 2.0 MiB for block index database 
    188 node0 2020-04-26T11:56:41.105405Z [init] * Using 8.0 MiB for chain state database 
    189 node0 2020-04-26T11:56:41.105441Z [init] * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space) 
    190 node0 2020-04-26T11:56:41.105462Z [init] init message: Loading block index... 
    191 node0 2020-04-26T11:56:41.105497Z [init] Switching active chainstate to Chainstate [ibd] @ height -1 (null) 
    192 node0 2020-04-26T11:56:41.105848Z [init] Opening LevelDB in /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/blocks/index 
    193 node0 2020-04-26T11:56:41.215067Z [init] Opened LevelDB successfully 
    194 node0 2020-04-26T11:56:41.215116Z [init] Using obfuscation key for /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/blocks/index: 0000000000000000 
    195 node0 2020-04-26T11:56:41.215156Z [init] LoadBlockIndexDB: last block file = 0 
    196 node0 2020-04-26T11:56:41.215179Z [init] LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01) 
    197 node0 2020-04-26T11:56:41.215192Z [init] Checking all blk files are present... 
    198 node0 2020-04-26T11:56:41.215209Z [init] Initializing databases... 
    199 node0 2020-04-26T11:56:41.215385Z [init] Pre-allocating up to position 0x1000000 in blk00000.dat 
    200 node0 2020-04-26T11:56:41.281411Z [init] Initializing chainstate Chainstate [ibd] @ height -1 (null) 
    201 node0 2020-04-26T11:56:41.281659Z [init] Opening LevelDB in /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/chainstate 
    202 node0 2020-04-26T11:56:41.334044Z [http] Received a POST request for / from 127.0.0.1:55701 
    203 node0 2020-04-26T11:56:41.348092Z [httpworker.1] ThreadRPCServer method=getblockcount user=__cookie__ 
    204 node0 2020-04-26T11:56:41.388851Z [init] Opened LevelDB successfully 
    205 node0 2020-04-26T11:56:41.389060Z [init] Wrote new obfuscate key for /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/chainstate: 73c001bc6fb0d573 
    206 node0 2020-04-26T11:56:41.389100Z [init] Using obfuscation key for /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/chainstate: 73c001bc6fb0d573 
    207 node0 2020-04-26T11:56:41.389177Z [init] init message: Rewinding blocks... 
    208 node0 2020-04-26T11:56:41.389220Z [init]  block index             284ms 
    209 node0 2020-04-26T11:56:41.389377Z [init] init message: Loading wallet... 
    210 node0 2020-04-26T11:56:41.389785Z [init] BerkeleyEnvironment::Open: LogDir=/var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/wallets/database ErrorFile=/var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/wallets/db.log 
    211 node0 2020-04-26T11:56:41.537808Z [init] [default wallet] Wallet File Version = 10500 
    212 node0 2020-04-26T11:56:41.538110Z [init] [default wallet] Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total. Unknown wallet records: 0 
    213 node0 2020-04-26T11:56:41.613654Z [http] Received a POST request for / from 127.0.0.1:55702 
    214 node0 2020-04-26T11:56:41.613824Z [httpworker.3] ThreadRPCServer method=getblockcount user=__cookie__ 
    215 node0 2020-04-26T11:56:41.772833Z [init] [default wallet] keypool added 2 keys (1 internal), size=2 (1 internal) 
    216 node0 2020-04-26T11:56:41.810418Z [init] [default wallet] LegacyScriptPubKeyMan::NewKeyPool rewrote keypool 
    217 node0 2020-04-26T11:56:41.845649Z [init] [default wallet] Wallet completed loading in             456ms 
    218 node0 2020-04-26T11:56:41.845860Z [init] [default wallet] setKeyPool.size() = 2 
    219 node0 2020-04-26T11:56:41.845953Z [init] [default wallet] mapWallet.size() = 0 
    220 node0 2020-04-26T11:56:41.845983Z [init] [default wallet] m_address_book.size() = 0 
    221 node0 2020-04-26T11:56:41.846755Z [loadblk]   - Load block from disk: 0.32ms [0.00s] 
    222 node0 2020-04-26T11:56:41.846863Z [loadblk] BlockChecked: block hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 state=Valid 
    223 node0 2020-04-26T11:56:41.846914Z [loadblk]   - Connect total: 0.17ms [0.00s (0.17ms/blk)] 
    224 node0 2020-04-26T11:56:41.846948Z [loadblk]   - Flush: 0.04ms [0.00s (0.04ms/blk)] 
    225 node0 2020-04-26T11:56:41.846992Z [loadblk]   - Writing chainstate: 0.04ms [0.00s (0.04ms/blk)] 
    226 node0 2020-04-26T11:56:41.847079Z [loadblk] UpdateTip: new best=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 height=0 version=0x00000001 log2_work=1 tx=1 date='2011-02-02T23:16:42Z' progress=1.000000 cache=0.0MiB(0txo) 
    227 node0 2020-04-26T11:56:41.847111Z [loadblk]   - Connect postprocess: 0.12ms [0.00s (0.12ms/blk)] 
    228 node0 2020-04-26T11:56:41.847138Z [loadblk] - Connect block: 0.68ms [0.00s (0.68ms/blk)] 
    229 node0 2020-04-26T11:56:41.847177Z [loadblk] Checking mempool with 0 transactions and 0 inputs 
    230 node0 2020-04-26T11:56:41.847234Z [loadblk] Enqueuing BlockConnected: block hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 block height=0 
    231 node0 2020-04-26T11:56:41.847293Z [loadblk] Enqueuing UpdatedBlockTip: new block hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 fork block hash=null (in IBD=true) 
    232 node0 2020-04-26T11:56:41.847367Z [scheduler] BlockConnected: block hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 block height=0 
    233 node0 2020-04-26T11:56:41.847450Z [init] block tree size = 1 
    234 node0 2020-04-26T11:56:41.847583Z [init] nBestHeight = 0 
    235 node0 2020-04-26T11:56:41.847657Z [loadblk] Failed to open mempool file from disk. Continuing anyway. 
    236 node0 2020-04-26T11:56:41.847738Z [scheduler] UpdatedBlockTip: new block hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 fork block hash=null (in IBD=true) 
    237 node0 2020-04-26T11:56:41.847878Z [init] Bound to 127.0.0.1:11794 
    238 node0 2020-04-26T11:56:41.847934Z [init] init message: Loading P2P addresses... 
    239 node0 2020-04-26T11:56:41.848032Z [init] ERROR: DeserializeFileDB: Failed to open file /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node0/regtest/peers.dat 
    240 node0 2020-04-26T11:56:41.848169Z [init] Invalid or missing peers.dat; recreating 
    241 node0 2020-04-26T11:56:41.861490Z [init] Flushed 0 addresses to peers.dat  13ms 
    242 node0 2020-04-26T11:56:41.861573Z [init] init message: Starting network threads... 
    243 node0 2020-04-26T11:56:41.861721Z [init] DNS seeding disabled 
    244 node0 2020-04-26T11:56:41.861901Z [init] init message: Done loading 
    245 node0 2020-04-26T11:56:41.863198Z [addcon] addcon thread start 
    246 node0 2020-04-26T11:56:41.863327Z [net] net thread start 
    247 node0 2020-04-26T11:56:41.863459Z [msghand] msghand thread start 
    248 node0 2020-04-26T11:56:41.863568Z [opencon] opencon thread start 
    249 node0 2020-04-26T11:56:41.868413Z [http] Received a POST request for / from 127.0.0.1:55703 
    250 node0 2020-04-26T11:56:41.868583Z [httpworker.2] ThreadRPCServer method=getblockcount user=__cookie__ 
    251 test  2020-04-26T11:56:41.869000Z TestFramework.node0 (DEBUG): RPC successfully started 
    252 node0 2020-04-26T11:56:44.375789Z [scheduler] Flushing wallet.dat 
    253 node0 2020-04-26T11:56:44.416852Z [scheduler] Flushed wallet.dat 41ms 
    254 node0 2020-04-26T11:57:41.009682Z [scheduler] Feeding 308 bytes of dynamic environment data into RNG 
    255 node0 2020-04-26T11:57:42.173548Z [opencon] Adding fixed seed nodes as DNS doesn't seem to be available. 
    256 test  2020-04-26T11:57:42.914000Z TestFramework.node0 (DEBUG): Stopping node 
    257 node0 2020-04-26T11:57:42.917544Z [http] Received a POST request for / from 127.0.0.1:55978 
    258 node0 2020-04-26T11:57:42.917698Z [httpworker.0] ThreadRPCServer method=stop user=__cookie__ 
    259 test  2020-04-26T11:57:42.918000Z TestFramework.node1 (DEBUG): Stopping node 
    260 test  2020-04-26T11:57:42.919000Z TestFramework (ERROR): Assertion failed 
    261                                   Traceback (most recent call last):
    262                                     File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_framework.py", line 434, in start_nodes
    263                                       node.wait_for_rpc_connection()
    264                                     File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_node.py", line 245, in wait_for_rpc_connection
    265                                       self._raise_assertion_error("Unable to connect to bitcoind after {}s".format(self.rpc_timeout))
    266                                     File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_node.py", line 158, in _raise_assertion_error
    267                                       raise AssertionError(self._node_msg(msg))
    268                                   AssertionError: [node 1] Unable to connect to bitcoind after 60s
    269                                   During handling of the above exception, another exception occurred:
    270                                   Traceback (most recent call last):
    271                                     File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_framework.py", line 111, in main
    272                                       self.setup()
    273                                     File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_framework.py", line 226, in setup
    274                                       self.setup_network()
    275                                     File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_framework.py", line 315, in setup_network
    276                                       self.setup_nodes()
    277                                     File "./test/functional/wallet_upgradewallet.py", line 56, in setup_nodes
    278                                       self.start_nodes()
    279                                     File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_framework.py", line 437, in start_nodes
    280                                       self.stop_nodes()
    281                                     File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_framework.py", line 453, in stop_nodes
    282                                       node.stop_node(wait=wait)
    283                                     File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_node.py", line 284, in stop_node
    284                                       self.stop()
    285                                     File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_node.py", line 175, in __getattr__
    286                                       assert self.rpc_connected and self.rpc is not None, self._node_msg("Error: no RPC connection")
    287                                   AssertionError: [node 1] Error: no RPC connection
    288 test  2020-04-26T11:57:42.926000Z TestFramework (DEBUG): Closing down network thread 
    289 test  2020-04-26T11:57:42.978000Z TestFramework (INFO): Stopping nodes 
    290 test  2020-04-26T11:57:42.979000Z TestFramework.node0 (DEBUG): Stopping node 
    291 node0 2020-04-26T11:57:42.979833Z [http] Received a POST request for / from 127.0.0.1:55979 
    292 node0 2020-04-26T11:57:42.979945Z [httpworker.1] ThreadRPCServer method=stop user=__cookie__ 
    
  9. MarcoFalke commented at 12:12 pm on April 26, 2020: member

    There are four cases that might continue the loop for 60 seconds. Can you add print statements to check which one it is?

     0            except JSONRPCException as e:  # Initialization phase
     1                # -28 RPC in warmup
     2                # -342 Service unavailable, RPC server started but is shutting down due to error
     3                if e.error['code'] != -28 and e.error['code'] != -342:
     4                    raise  # unknown JSON RPC exception
     5            except ConnectionResetError:
     6                # This might happen when the RPC server is in warmup, but shut down before the call to getblockcount
     7                # succeeds. Try again to properly raise the FailedToStartError
     8                pass
     9            except OSError as e:
    10                if e.errno != errno.ECONNREFUSED:  # Port not yet open?
    11                    raise  # unknown OS error
    12            except ValueError as e:  # cookie file not found and no rpcuser or rpcpassword; bitcoind is still starting
    13                if "No RPC credentials" not in str(e):
    14                    raise
    
  10. brakmic commented at 12:17 pm on April 26, 2020: contributor

    When I add print’s to it I get this while running the test:

     0./test/functional/wallet_upgradewallet.py                                                     (736ms)  
     12020-04-26T12:16:28.456000Z TestFramework (INFO): Initializing test directory /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_c8qst9si
     2EXCEPTION: ValueError No RPC credentials
     3EXCEPTION: ValueError No RPC credentials
     4EXCEPTION: JSONRPCException Loading block index... (-28)
     5EXCEPTION: JSONRPCException Loading wallet... (-28)
     6EXCEPTION: JSONRPCException Loading wallet... (-28)
     7EXCEPTION: [Errno 61] Connection refused
     8EXCEPTION: [Errno 61] Connection refused
     9EXCEPTION: [Errno 61] Connection refused
    10EXCEPTION: [Errno 61] Connection refused
    

    And it continues like that.

  11. MarcoFalke commented at 12:46 pm on April 26, 2020: member

    So

    • the node starts correctly
    • the authproxy has the right credentials
    • ?
  12. MarcoFalke commented at 12:56 pm on April 26, 2020: member

    It seems to be using the default ports. Can you try with this:

     0diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
     1index 64e1aa3bbc..65cb7ffb7a 100644
     2--- a/test/functional/test_framework/util.py
     3+++ b/test/functional/test_framework/util.py
     4@@ -310,7 +310,7 @@ def initialize_datadir(dirname, n, chain):
     5         chain_name_conf_section = chain
     6     with open(os.path.join(datadir, "bitcoin.conf"), 'w', encoding='utf8') as f:
     7         f.write("{}=1\n".format(chain_name_conf_arg))
     8-        f.write("[{}]\n".format(chain_name_conf_section))
     9+        #f.write("[{}]\n".format(chain_name_conf_section))
    10         f.write("port=" + str(p2p_port(n)) + "\n")
    11         f.write("rpcport=" + str(rpc_port(n)) + "\n")
    12         f.write("fallbackfee=0.0002\n")
    
  13. brakmic commented at 12:56 pm on April 26, 2020: contributor

    So

    • the node starts correctly
    • the authproxy has the right credentials
    • ?

    Not sure about credentials as I am using v0.16.3 the same way as with newer nodes from ./test/functional/feature_backwards_compatibility.py. Basically, I downloaded the binary with previous_release.sh, then given the paths to self.add_nodes and hoped it’d start it the same way it did with other nodes.

  14. brakmic commented at 12:59 pm on April 26, 2020: contributor

    It seems to be using the default ports. Can you try with this:

     0diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
     1index 64e1aa3bbc..65cb7ffb7a 100644
     2--- a/test/functional/test_framework/util.py
     3+++ b/test/functional/test_framework/util.py
     4@@ -310,7 +310,7 @@ def initialize_datadir(dirname, n, chain):
     5         chain_name_conf_section = chain
     6     with open(os.path.join(datadir, "bitcoin.conf"), 'w', encoding='utf8') as f:
     7         f.write("{}=1\n".format(chain_name_conf_arg))
     8-        f.write("[{}]\n".format(chain_name_conf_section))
     9+        #f.write("[{}]\n".format(chain_name_conf_section))
    10         f.write("port=" + str(p2p_port(n)) + "\n")
    11         f.write("rpcport=" + str(rpc_port(n)) + "\n")
    12         f.write("fallbackfee=0.0002\n")
    

    Have tried it, same error: no rpc credentials:

     02020-04-26T12:58:29.540000Z TestFramework (INFO): Initializing test directory /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_zq4ik840
     1EXCEPTION: ValueError No RPC credentials
     22020-04-26T12:58:29.808000Z TestFramework (ERROR): Assertion failed
     3Traceback (most recent call last):
     4  File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_framework.py", line 434, in start_nodes
     5    node.wait_for_rpc_connection()
     6  File "/Users/brakmic/projects/bitcoin-dev/btc-master/test/functional/test_framework/test_node.py", line 217, in wait_for_rpc_connection
     7    'bitcoind exited with status {} during initialization'.format(self.process.returncode)))
     8test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization
     9
    10During handling of the above exception, another exception occurred:
    
  15. MarcoFalke commented at 1:01 pm on April 26, 2020: member
    This is not the same error. The previous error was EXCEPTION: [Errno 61] Connection refused.
  16. MarcoFalke commented at 1:03 pm on April 26, 2020: member

    This is the excerpt from the 0.16 debug log:

     0                                   2020-04-26 11:56:40.864468 Allowing HTTP connections from: 127.0.0.0/8 ::1/128 
     1                                   2020-04-26 11:56:40.866260 Binding RPC on address ::1 port 18443
     2                                   2020-04-26 11:56:40.872933 Binding RPC on address 127.0.0.1 port 18443
     3                                   2020-04-26 11:56:40.873025 Initialized HTTP server
     4                                   2020-04-26 11:56:40.873054 HTTP: creating work queue of depth 16
     5                                   2020-04-26 11:56:40.873075 Starting RPC
     6                                   2020-04-26 11:56:40.873113 Starting HTTP RPC server
     7                                   2020-04-26 11:56:40.873134 No rpcpassword set - using random cookie authentication
     8                                   2020-04-26 11:56:40.873470 Generated RPC authentication cookie /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/.cookie
     9                                   2020-04-26 11:56:40.873508 Registering HTTP handler for / (exactmatch 1)
    10                                   2020-04-26 11:56:40.873532 Registering HTTP handler for /wallet/ (exactmatch 0)
    11                                   2020-04-26 11:56:40.873558 Starting HTTP server
    

    You want it to use the right rpc_port

  17. brakmic commented at 1:05 pm on April 26, 2020: contributor

    This is the excerpt from the 0.16 debug log:

     0                                   2020-04-26 11:56:40.864468 Allowing HTTP connections from: 127.0.0.0/8 ::1/128 
     1                                   2020-04-26 11:56:40.866260 Binding RPC on address ::1 port 18443
     2                                   2020-04-26 11:56:40.872933 Binding RPC on address 127.0.0.1 port 18443
     3                                   2020-04-26 11:56:40.873025 Initialized HTTP server
     4                                   2020-04-26 11:56:40.873054 HTTP: creating work queue of depth 16
     5                                   2020-04-26 11:56:40.873075 Starting RPC
     6                                   2020-04-26 11:56:40.873113 Starting HTTP RPC server
     7                                   2020-04-26 11:56:40.873134 No rpcpassword set - using random cookie authentication
     8                                   2020-04-26 11:56:40.873470 Generated RPC authentication cookie /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/regtest/.cookie
     9                                   2020-04-26 11:56:40.873508 Registering HTTP handler for / (exactmatch 1)
    10                                   2020-04-26 11:56:40.873532 Registering HTTP handler for /wallet/ (exactmatch 0)
    11                                   2020-04-26 11:56:40.873558 Starting HTTP server
    

    You want it to use the right rpc_port

    I actually hoped, it would do it without any additional config. My problem is: what to do to make v0.16.3 run with the test_framework.

  18. MarcoFalke commented at 1:08 pm on April 26, 2020: member

    I have no idea why 0.16.3 is not picking up the -rpcport setting.

    What is

    0cat  /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_foobar/node1/bitcoin.conf
    1./releases_path/v0.16.3/bin/bitcoind -datadir=/var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_foobar/node1/
    2^C
    
  19. brakmic commented at 1:11 pm on April 26, 2020: contributor

    I have no idea why 0.16.3 is not picking up the -rpcport setting.

    What is

    0cat  /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_foobar/node1/bitcoin.conf
    1./releases_path/v0.16.3/bin/bitcoind -datadir=/var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_foobar/node1/
    2^C
    

    This is the content of node1’s bitcoin.conf, which is the v0.16.3 node on my machine. The rpcport is there:

     0cat /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_jdbyq_69/node1/bitcoin.conf 
     1regtest=1
     2port=12391
     3rpcport=17391
     4fallbackfee=0.0002
     5server=1
     6keypool=1
     7discover=0
     8dnsseed=0
     9listenonion=0
    10printtoconsole=0
    11upnp=0
    12shrinkdebugfile=0
    13bind=127.0.0.1
    
  20. brakmic commented at 1:13 pm on April 26, 2020: contributor

    Maybe v0.16.3 doesn’t read this bitcoin.conf automatically (for whatever reason). Maybe we should try starting it with explicit –conf=path_to_conf.

    Just speculating.

  21. MarcoFalke commented at 1:18 pm on April 26, 2020: member

    It does use it:

    0                                   2020-04-26 11:56:40.843422 Using config file /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/bitcoin.conf
    
  22. brakmic commented at 1:19 pm on April 26, 2020: contributor

    It does use it:

    0                                   2020-04-26 11:56:40.843422 Using config file /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_7nf60xj7/node1/bitcoin.conf
    

    Well, then we have entered the weird reasons territory. :)

  23. brakmic commented at 1:23 pm on April 26, 2020: contributor

    When I add this to util.py

    0f.write("rpcuser=dummy\n")
    1f.write("rpcpassword=dummypwd\n")
    

    I get this error:

    0./test/functional/wallet_upgradewallet.py                                                 (775ms)12020-04-26T13:21:53.390000Z TestFramework (INFO): Initializing test directory /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_8knpfnb1
    2EXCEPTION: [Errno 61] Connection refused
    32020-04-26T13:21:53.670000Z TestFramework (ERROR): Assertion failed
    4Traceback (most recent call last):
    

    No more no RPC credentials.

  24. MarcoFalke commented at 2:53 pm on April 26, 2020: member

    Works for me:

     0root@d016acdaf338:/# batcat /tmp/node1/bitcoin.conf 
     1───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────
     2       │ File: /tmp/node1/bitcoin.conf
     3───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────
     4   1   │ regtest=1
     5   2   │ port=12391
     6   3   │ rpcport=17391
     7   4   │ fallbackfee=0.0002
     8   5   │ server=1
     9   6   │ keypool=1
    10   7   │ discover=0
    11   8   │ dnsseed=0
    12   9   │ listenonion=0
    13  10   │ printtoconsole=0
    14  11   │ upnp=0
    15  12   │ shrinkdebugfile=0
    16  13   │ bind=127.0.0.1
    17───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────
    18root@d016acdaf338:/# ./bitcoin-0.16.3/bin/bitcoind -datadir=/tmp/node1/ -printtoconsole -debug|grep 'RPC on address'
    192020-04-26 14:52:40 Binding RPC on address ::1 port 17391
    202020-04-26 14:52:40 Binding RPC on address 127.0.0.1 port 17391
    21^C
    
  25. MarcoFalke commented at 2:54 pm on April 26, 2020: member

    So the section is the issue:

     0root@d016acdaf338:/# batcat /tmp/node1/bitcoin.conf 
     1───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────
     2       │ File: /tmp/node1/bitcoin.conf
     3───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────
     4   1   │ regtest=1
     5   2   │ [regtest]
     6   3   │ port=12391
     7   4   │ rpcport=17391
     8   5   │ fallbackfee=0.0002
     9   6   │ server=1
    10   7   │ keypool=1
    11   8   │ discover=0
    12   9   │ dnsseed=0
    13  10   │ listenonion=0
    14  11   │ printtoconsole=0
    15  12   │ upnp=0
    16  13   │ shrinkdebugfile=0
    17  14   │ bind=127.0.0.1
    18───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────
    19root@d016acdaf338:/# ./bitcoin-0.16.3/bin/bitcoind -datadir=/tmp/node1/ -printtoconsole -debug|grep 'RPC on address'
    202020-04-26 14:53:48 Binding RPC on address ::1 port 18443
    212020-04-26 14:53:48 Binding RPC on address 127.0.0.1 port 18443
    22^C
    
  26. MarcoFalke commented at 2:55 pm on April 26, 2020: member

    So before you start the 0.16.3 node, remove this line from the bitcoin.conf:

    #18767 (comment)

  27. brakmic commented at 2:55 pm on April 26, 2020: contributor
    So it would make sense to provide a fix for the section issue first?
  28. MarcoFalke commented at 2:55 pm on April 26, 2020: member
    It will be fine if you do it in the same pull request.
  29. brakmic commented at 2:56 pm on April 26, 2020: contributor

    It will be fine if you do it in the same pull request.

    Ok, no problem. Will fix it there and then rewrite the test. That is, will use my original solution that didn’t work.

    Thanks for helping me out!

  30. brakmic commented at 3:23 pm on April 26, 2020: contributor

    One question regarding fixing of util.py:

    As I don’t see any option to check for bitcoind version that should read those settings, I am applying this cheap trick to make old bitcoind’s accept port/rpcport settings:

     0diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
     1index 64e1aa3bb..44d1c8509 100644
     2--- a/test/functional/test_framework/util.py
     3+++ b/test/functional/test_framework/util.py
     4@@ -310,6 +310,8 @@ def initialize_datadir(dirname, n, chain):
     5         chain_name_conf_section = chain
     6     with open(os.path.join(datadir, "bitcoin.conf"), 'w', encoding='utf8') as f:
     7         f.write("{}=1\n".format(chain_name_conf_arg))
     8+        f.write("port=" + str(p2p_port(n)) + "\n")
     9+        f.write("rpcport=" + str(rpc_port(n)) + "\n")
    10         f.write("[{}]\n".format(chain_name_conf_section))
    11         f.write("port=" + str(p2p_port(n)) + "\n")
    12         f.write("rpcport=" + str(rpc_port(n)) + "\n")
    

    So, I’m just putting these two settings above the section name. Old bitcoind’s would read them and ignore the rest, while new ones would simply ignore redundant entries.

    However, not sure if this is the cleanest approach. Is there a way to find out the node version?

    I could try to expand the initialize_datadir function, but this seems to be a bit too invasive, imo.

    My tests with the now rewritten wallet_upgradewallet.py are successful, v0.16.3 bitcoind runs without any problems.

  31. MarcoFalke closed this on Apr 29, 2020

  32. DrahtBot locked this on Feb 15, 2022
  33. vijaydasmp referenced this in commit 23fd510b16 on Aug 17, 2022
  34. vijaydasmp referenced this in commit 4a9443c078 on Aug 26, 2022
  35. vijaydasmp referenced this in commit bdfbb163a8 on Aug 26, 2022
  36. vijaydasmp referenced this in commit 79f89d0181 on Aug 26, 2022
  37. vijaydasmp referenced this in commit 8d847cdd5e on Aug 27, 2022
  38. vijaydasmp referenced this in commit 1ad1e3af2a on Aug 28, 2022
  39. vijaydasmp referenced this in commit 995104d9ba on Aug 29, 2022
  40. vijaydasmp referenced this in commit 7d304dec2b on Aug 29, 2022
  41. vijaydasmp referenced this in commit 8676fd5949 on Sep 1, 2022
  42. vijaydasmp referenced this in commit 7e127280bf on Sep 3, 2022
  43. vijaydasmp referenced this in commit 61ad888659 on Sep 4, 2022
  44. vijaydasmp referenced this in commit e66f5f3cc4 on Sep 4, 2022
  45. vijaydasmp referenced this in commit eac6ee0f74 on Sep 5, 2022
  46. vijaydasmp referenced this in commit 15bdb49d81 on Sep 8, 2022
  47. vijaydasmp referenced this in commit fd042bed90 on Sep 9, 2022
  48. vijaydasmp referenced this in commit 7c9023efc9 on Sep 11, 2022
  49. vijaydasmp referenced this in commit 25f2b61e62 on Sep 11, 2022
  50. vijaydasmp referenced this in commit ed096a5d28 on Sep 16, 2022
  51. ogabrielides referenced this in commit f384bbe60f on Sep 26, 2022
  52. michael-EA referenced this in commit 9f389b0705 on Oct 22, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-21 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me