Merge #21411: test: add logging, reduce blocks, move sync_all in wallet_ groups

c62f9bc0e931f65eef63041d2c53f9a294c0e8d6 test: use fewer blocks in wallet_groups and move sync call (Jon Atack)
3a16b5ef95c1c25f8b78e591f985e80b41a6dbdd test: add missing logging to wallet_groups.py (Jon Atack)

Pull request description:

  - add logging (particularly useful as the tests are somewhat slow)
  - generate 101 blocks instead of 110
  - move `sync_all` call into the loop, so fewer blocks are synced on each call, to hopefully see fewer CI timeouts as in https://bitcoinbuilds.org/index.php?ansilog=88eee99e-1727-44ed-b778-3b9c75c33928.log

  ```
  L2742     File "/home/ubuntu/src/test/functional/wallet_groups.py", line 162, in run_test
  L2743       self.sync_all()
  test_framework.authproxy.JSONRPCException: 'syncwithvalidationinterfacequeue' RPC took longer than 960.000000 seconds. Consider using larger timeout for calls that take longer to return. (-344)
  ```

ACKs for top commit:
  MarcoFalke:
    cr ACK c62f9bc0e931f65eef63041d2c53f9a294c0e8d6

Tree-SHA512: 711deafcd589cb8196cb207ff882e0f2ab6b70828a6abad91f83f535974cc430a56b9e8a960fd233d31d610932a0d48b49ee681aae564d145a3040288ecda8f8
This commit is contained in:
MarcoFalke 2021-03-11 19:08:26 +01:00 committed by Konstantin Akimov
parent 0a62b9f985
commit d9c31d6817
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -32,8 +32,9 @@ class WalletGroupTest(BitcoinTestFramework):
self.skip_if_no_wallet() self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.log.info("Setting up")
# Mine some coins # Mine some coins
self.nodes[0].generate(COINBASE_MATURITY + 10) self.nodes[0].generate(COINBASE_MATURITY + 1)
# Get some addresses from the two nodes # Get some addresses from the two nodes
addr1 = [self.nodes[1].getnewaddress() for _ in range(3)] addr1 = [self.nodes[1].getnewaddress() for _ in range(3)]
@ -51,6 +52,7 @@ class WalletGroupTest(BitcoinTestFramework):
# - node[1] should pick one 0.5 UTXO and leave the rest # - node[1] should pick one 0.5 UTXO and leave the rest
# - node[2] should pick one (1.0 + 0.5) UTXO group corresponding to a # - node[2] should pick one (1.0 + 0.5) UTXO group corresponding to a
# given address, and leave the rest # given address, and leave the rest
self.log.info("Test sending transactions picks one UTXO group and leaves the rest")
txid1 = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 0.2) txid1 = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 0.2)
tx1 = self.nodes[1].getrawtransaction(txid1, True) tx1 = self.nodes[1].getrawtransaction(txid1, True)
# txid1 should have 1 input and 2 outputs # txid1 should have 1 input and 2 outputs
@ -73,7 +75,7 @@ class WalletGroupTest(BitcoinTestFramework):
assert_approx(v[0], vexp=0.2, vspan=0.0001) assert_approx(v[0], vexp=0.2, vspan=0.0001)
assert_approx(v[1], vexp=1.3, vspan=0.0001) assert_approx(v[1], vexp=1.3, vspan=0.0001)
# Test 'avoid partial if warranted, even if disabled' self.log.info("Test avoiding partial spends if warranted, even if avoidpartialspends is disabled")
self.sync_all() self.sync_all()
self.nodes[0].generate(1) self.nodes[0].generate(1)
# Nodes 1-2 now have confirmed UTXOs (letters denote destinations): # Nodes 1-2 now have confirmed UTXOs (letters denote destinations):
@ -107,7 +109,7 @@ class WalletGroupTest(BitcoinTestFramework):
assert_equal(input_addrs[0], input_addrs[1]) assert_equal(input_addrs[0], input_addrs[1])
# Node 2 enforces avoidpartialspends so needs no checking here # Node 2 enforces avoidpartialspends so needs no checking here
# Test wallet option maxapsfee with Node 3 self.log.info("Test wallet option maxapsfee")
addr_aps = self.nodes[3].getnewaddress() addr_aps = self.nodes[3].getnewaddress()
self.nodes[0].sendtoaddress(addr_aps, 1.0) self.nodes[0].sendtoaddress(addr_aps, 1.0)
self.nodes[0].sendtoaddress(addr_aps, 1.0) self.nodes[0].sendtoaddress(addr_aps, 1.0)
@ -134,6 +136,7 @@ class WalletGroupTest(BitcoinTestFramework):
# Test wallet option maxapsfee with node 4, which sets maxapsfee # Test wallet option maxapsfee with node 4, which sets maxapsfee
# 1 sat higher, crossing the threshold from non-grouped to grouped. # 1 sat higher, crossing the threshold from non-grouped to grouped.
self.log.info("Test wallet option maxapsfee threshold from non-grouped to grouped")
addr_aps3 = self.nodes[4].getnewaddress() addr_aps3 = self.nodes[4].getnewaddress()
[self.nodes[0].sendtoaddress(addr_aps3, 1.0) for _ in range(5)] [self.nodes[0].sendtoaddress(addr_aps3, 1.0) for _ in range(5)]
self.nodes[0].generate(1) self.nodes[0].generate(1)
@ -150,8 +153,7 @@ class WalletGroupTest(BitcoinTestFramework):
self.sync_all() self.sync_all()
self.nodes[0].generate(1) self.nodes[0].generate(1)
# Fill node2's wallet with 10000 outputs corresponding to the same self.log.info("Fill a wallet with 10,000 outputs corresponding to the same scriptPubKey")
# scriptPubKey
for _ in range(5): for _ in range(5):
raw_tx = self.nodes[0].createrawtransaction([{"txid":"0"*64, "vout":0}], [{addr2[0]: 0.05}]) raw_tx = self.nodes[0].createrawtransaction([{"txid":"0"*64, "vout":0}], [{addr2[0]: 0.05}])
tx = tx_from_hex(raw_tx) tx = tx_from_hex(raw_tx)
@ -161,12 +163,12 @@ class WalletGroupTest(BitcoinTestFramework):
signed_tx = self.nodes[0].signrawtransactionwithwallet(funded_tx['hex']) signed_tx = self.nodes[0].signrawtransactionwithwallet(funded_tx['hex'])
self.nodes[0].sendrawtransaction(signed_tx['hex']) self.nodes[0].sendrawtransaction(signed_tx['hex'])
self.nodes[0].generate(1) self.nodes[0].generate(1)
self.sync_all() self.sync_all()
# Check that we can create a transaction that only requires ~100 of our # Check that we can create a transaction that only requires ~100 of our
# utxos, without pulling in all outputs and creating a transaction that # utxos, without pulling in all outputs and creating a transaction that
# is way too big. # is way too big.
self.log.info("Test creating txn that only requires ~100 of our UTXOs without pulling in all outputs")
assert self.nodes[2].sendtoaddress(address=addr2[0], amount=5) assert self.nodes[2].sendtoaddress(address=addr2[0], amount=5)