diff --git a/qa/rpc-tests/mempool_nu_activation.py b/qa/rpc-tests/mempool_nu_activation.py index d4660c37b..5f76d17a8 100755 --- a/qa/rpc-tests/mempool_nu_activation.py +++ b/qa/rpc-tests/mempool_nu_activation.py @@ -6,6 +6,7 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal, initialize_chain_clean, \ start_node, connect_nodes, wait_and_assert_operationid_status +from test_framework.authproxy import JSONRPCException from decimal import Decimal @@ -63,8 +64,16 @@ class MempoolUpgradeActivationTest(BitcoinTestFramework): # Fill the mempool with twice as many transactions as can fit into blocks node0_taddr = self.nodes[0].getnewaddress() x_txids = [] + info = self.nodes[0].getblockchaininfo() + chaintip_branchid = info["consensus"]["chaintip"] while self.nodes[1].getmempoolinfo()['bytes'] < 2 * 4000: - x_txids.append(self.nodes[1].sendtoaddress(node0_taddr, Decimal('0.001'))) + try: + x_txids.append(self.nodes[1].sendtoaddress(node0_taddr, Decimal('0.001'))) + assert_equal(chaintip_branchid, "00000000") + except JSONRPCException: + # This fails due to expiring soon threshold, which applies from Overwinter onwards. + assert_equal(info["upgrades"][chaintip_branchid]["name"], "Overwinter") + break self.sync_all() # Spends should be in the mempool @@ -79,12 +88,14 @@ class MempoolUpgradeActivationTest(BitcoinTestFramework): # mempool should be empty. assert_equal(set(self.nodes[0].getrawmempool()), set()) + # When transitioning from Sprout to Overwinter, where expiring soon threshold does not apply: # Block H - 1 should contain a subset of the original mempool # (with all other transactions having been dropped) block_txids = self.nodes[0].getblock(self.nodes[0].getbestblockhash())['tx'] - assert(len(block_txids) < len(x_txids)) - for txid in block_txids[1:]: # Exclude coinbase - assert(txid in x_txids) + if chaintip_branchid is "00000000": + assert(len(block_txids) < len(x_txids)) + for txid in block_txids[1:]: # Exclude coinbase + assert(txid in x_txids) # Create some transparent Y transactions y_txids = [self.nodes[1].sendtoaddress(node0_taddr, Decimal('0.001')) for i in range(10)] diff --git a/qa/rpc-tests/regtest_signrawtransaction.py b/qa/rpc-tests/regtest_signrawtransaction.py index 2e0273677..93caceb3b 100755 --- a/qa/rpc-tests/regtest_signrawtransaction.py +++ b/qa/rpc-tests/regtest_signrawtransaction.py @@ -11,7 +11,7 @@ class RegtestSignrawtransactionTest (BitcoinTestFramework): def setup_nodes(self): return start_nodes(4, self.options.tmpdir, [[ "-nuparams=5ba81b19:200", # Overwinter - "-nuparams=76b809bb:204", # Sapling + "-nuparams=76b809bb:206", # Sapling ]] * 4) def run_test(self): diff --git a/qa/rpc-tests/wallet_listnotes.py b/qa/rpc-tests/wallet_listnotes.py index 3b403ff81..04428a3e4 100755 --- a/qa/rpc-tests/wallet_listnotes.py +++ b/qa/rpc-tests/wallet_listnotes.py @@ -14,7 +14,7 @@ class WalletListNotes(BitcoinTestFramework): def setup_nodes(self): return start_nodes(4, self.options.tmpdir, [[ '-nuparams=5ba81b19:202', # Overwinter - '-nuparams=76b809bb:204', # Sapling + '-nuparams=76b809bb:214', # Sapling ]] * 4) def run_test(self): @@ -105,9 +105,9 @@ class WalletListNotes(BitcoinTestFramework): assert_equal(unspent_tx[1], unspent_tx_filter[0]) # Set current height to 204 -> Sapling - self.nodes[0].generate(2) + self.nodes[0].generate(12) self.sync_all() - assert_equal(204, self.nodes[0].getblockcount()) + assert_equal(214, self.nodes[0].getblockcount()) # No funds in saplingzaddr yet assert_equal(0, len(self.nodes[0].z_listunspent(0, 9999, False, [saplingzaddr]))) diff --git a/qa/rpc-tests/wallet_listreceived.py b/qa/rpc-tests/wallet_listreceived.py index 5d9e583ee..f74a6c50e 100755 --- a/qa/rpc-tests/wallet_listreceived.py +++ b/qa/rpc-tests/wallet_listreceived.py @@ -20,11 +20,13 @@ class ListReceivedTest (BitcoinTestFramework): def setup_nodes(self): return start_nodes(4, self.options.tmpdir, [[ "-nuparams=5ba81b19:201", # Overwinter - "-nuparams=76b809bb:204", # Sapling + "-nuparams=76b809bb:214", # Sapling ]] * 4) def generate_and_sync(self, new_height): - self.nodes[0].generate(1) + current_height = self.nodes[0].getblockcount() + assert(new_height > current_height) + self.nodes[0].generate(new_height - current_height) self.sync_all() assert_equal(new_height, self.nodes[0].getblockcount()) @@ -92,7 +94,7 @@ class ListReceivedTest (BitcoinTestFramework): def run_test(self): self.run_test_release('sprout', 200) - self.run_test_release('sapling', 204) + self.run_test_release('sapling', 214) if __name__ == '__main__': ListReceivedTest().main()