mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
test: remove redundant sync after generate*
calls in Bitcoin tests
This commit is contained in:
parent
a99a39ce8d
commit
dfeeb34d18
@ -27,9 +27,7 @@ class FeatureBlockfilterindexPruneTest(BitcoinTestFramework):
|
||||
assert_greater_than(len(self.nodes[0].getblockfilter(self.nodes[0].getbestblockhash())['filter']), 0)
|
||||
# Mine two batches of blocks to avoid hitting NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection
|
||||
self.generate(self.nodes[0], 250)
|
||||
self.sync_all()
|
||||
self.generate(self.nodes[0], 250)
|
||||
self.sync_all()
|
||||
self.sync_index(height=700)
|
||||
|
||||
self.log.info("prune some blocks")
|
||||
|
@ -184,7 +184,6 @@ class CoinStatsIndexTest(BitcoinTestFramework):
|
||||
|
||||
# Include both txs in a block
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
for hash_option in index_hash_options:
|
||||
# Check all amounts were registered correctly
|
||||
@ -285,7 +284,6 @@ class CoinStatsIndexTest(BitcoinTestFramework):
|
||||
# Add another block, so we don't depend on reconsiderblock remembering which
|
||||
# blocks were touched by invalidateblock
|
||||
self.generate(index_node, 1)
|
||||
self.sync_all()
|
||||
|
||||
# Ensure that removing and re-adding blocks yields consistent results
|
||||
block = index_node.getblockhash(99)
|
||||
|
@ -98,7 +98,6 @@ class MinimumChainWorkTest(BitcoinTestFramework):
|
||||
# insufficient work chain, in which case we'd need to reconnect them to
|
||||
# continue the test.
|
||||
|
||||
self.sync_all()
|
||||
self.log.info("Blockcounts: %s", [n.getblockcount() for n in self.nodes])
|
||||
|
||||
self.log.info("Test that getheaders requests to node2 are not ignored")
|
||||
|
@ -85,9 +85,7 @@ class RESTTest (BitcoinTestFramework):
|
||||
not_related_address = "yj949n1UH6fDhw6HtVE5VMj2iSTaSWBMcW"
|
||||
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
self.generatetoaddress(self.nodes[1], 100, not_related_address)
|
||||
self.sync_all()
|
||||
|
||||
assert_equal(self.nodes[0].getbalance(), 500)
|
||||
|
||||
@ -118,7 +116,6 @@ class RESTTest (BitcoinTestFramework):
|
||||
self.log.info("Query an unspent TXO using the /getutxos URI")
|
||||
|
||||
self.generatetoaddress(self.nodes[1], 1, not_related_address)
|
||||
self.sync_all()
|
||||
bb_hash = self.nodes[0].getbestblockhash()
|
||||
|
||||
assert_equal(self.nodes[1].getbalance(), Decimal("0.1"))
|
||||
@ -193,7 +190,6 @@ class RESTTest (BitcoinTestFramework):
|
||||
assert_equal(len(json_obj['utxos']), 0)
|
||||
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
json_obj = self.test_rest_request("/getutxos/{}-{}".format(*spending))
|
||||
assert_equal(len(json_obj['utxos']), 1)
|
||||
@ -214,7 +210,6 @@ class RESTTest (BitcoinTestFramework):
|
||||
self.test_rest_request("/getutxos/checkmempool/{}".format(long_uri), http_method='POST', status=200)
|
||||
|
||||
self.generate(self.nodes[0], 1) # generate block to not affect upcoming tests
|
||||
self.sync_all()
|
||||
|
||||
self.log.info("Test the /block, /blockhashbyheight and /headers URIs")
|
||||
bb_hash = self.nodes[0].getbestblockhash()
|
||||
@ -285,7 +280,6 @@ class RESTTest (BitcoinTestFramework):
|
||||
|
||||
# See if we can get 5 headers in one response
|
||||
self.generate(self.nodes[1], 5)
|
||||
self.sync_all()
|
||||
json_obj = self.test_rest_request("/headers/5/{}".format(bb_hash))
|
||||
assert_equal(len(json_obj), 5) # now we should have 5 header objects
|
||||
|
||||
@ -320,7 +314,6 @@ class RESTTest (BitcoinTestFramework):
|
||||
|
||||
# Now mine the transactions
|
||||
newblockhash = self.generate(self.nodes[1], 1)
|
||||
self.sync_all()
|
||||
|
||||
# Check if the 3 tx show up in the new block
|
||||
json_obj = self.test_rest_request("/block/{}".format(newblockhash[0]))
|
||||
|
@ -189,8 +189,6 @@ class ZMQTest (BitcoinTestFramework):
|
||||
self.log.info("Generate %(n)d blocks (and %(n)d coinbase txes)" % {"n": num_blocks})
|
||||
genhashes = self.generatetoaddress(self.nodes[0], num_blocks, ADDRESS_BCRT1_UNSPENDABLE)
|
||||
|
||||
self.sync_all()
|
||||
|
||||
for x in range(num_blocks):
|
||||
# Should receive the coinbase txid.
|
||||
txid = hashtx.receive()
|
||||
@ -344,7 +342,6 @@ class ZMQTest (BitcoinTestFramework):
|
||||
# removed from the mempool by the block mining it.
|
||||
mempool_size = len(self.nodes[0].getrawmempool())
|
||||
c_block = self.generatetoaddress(self.nodes[0], 1, ADDRESS_BCRT1_UNSPENDABLE)[0]
|
||||
self.sync_all()
|
||||
# Make sure the number of mined transactions matches the number of txs out of mempool
|
||||
mempool_size_delta = mempool_size - len(self.nodes[0].getrawmempool())
|
||||
assert_equal(len(self.nodes[0].getblock(c_block)["tx"])-1, mempool_size_delta)
|
||||
@ -384,7 +381,6 @@ class ZMQTest (BitcoinTestFramework):
|
||||
# Other things may happen but aren't wallet-deterministic so we don't test for them currently
|
||||
self.nodes[0].reconsiderblock(best_hash)
|
||||
self.generatetoaddress(self.nodes[1], 1, ADDRESS_BCRT1_UNSPENDABLE)
|
||||
self.sync_all()
|
||||
|
||||
self.log.info("Evict mempool transaction by block conflict")
|
||||
orig_txid = self.nodes[0].sendtoaddress(address=self.nodes[0].getnewaddress(), amount=1.0)
|
||||
@ -429,7 +425,6 @@ class ZMQTest (BitcoinTestFramework):
|
||||
assert_equal((orig_txid_2, "A", mempool_seq), seq.receive_sequence())
|
||||
mempool_seq += 1
|
||||
self.generatetoaddress(self.nodes[0], 1, ADDRESS_BCRT1_UNSPENDABLE)
|
||||
self.sync_all() # want to make sure we didn't break "consensus" for other tests
|
||||
|
||||
def test_mempool_sync(self):
|
||||
"""
|
||||
|
@ -312,7 +312,6 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||
|
||||
# Mine these in a block
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# Now generate tx8, with a big fee
|
||||
inputs = [ {'txid' : tx1_id, 'vout': 0}, {'txid' : txid, 'vout': 0} ]
|
||||
|
@ -67,7 +67,6 @@ class P2PIBDTxRelayTest(BitcoinTestFramework):
|
||||
|
||||
# Come out of IBD by generating a block
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
self.log.info("Check that nodes process the same transaction, even when unsolicited, when no longer in IBD")
|
||||
peer_txer = self.nodes[0].add_p2p_connection(P2PInterface())
|
||||
|
@ -116,7 +116,6 @@ class P2PPermissionsTests(BitcoinTestFramework):
|
||||
|
||||
def check_tx_relay(self):
|
||||
block_op_true = self.nodes[0].getblock(self.generatetoaddress(self.nodes[0], 100, ADDRESS_BCRT1_P2SH_OP_TRUE)[0])
|
||||
self.sync_all()
|
||||
|
||||
self.log.debug("Create a connection from a forcerelay peer that rebroadcasts raw txs")
|
||||
# A test framework p2p connection is needed to send the raw transaction directly. If a full node was used, it could only
|
||||
|
@ -45,7 +45,6 @@ class RpcCreateMultiSigTest(BitcoinTestFramework):
|
||||
|
||||
self.log.info('Generating blocks ...')
|
||||
self.generate(node0, 149)
|
||||
self.sync_all()
|
||||
|
||||
self.moved = 0
|
||||
for self.nkeys in [3, 5]:
|
||||
@ -102,7 +101,6 @@ class RpcCreateMultiSigTest(BitcoinTestFramework):
|
||||
def checkbalances(self):
|
||||
node0, node1, node2 = self.nodes
|
||||
self.generate(node0, 1)
|
||||
self.sync_all()
|
||||
|
||||
bal0 = node0.getbalance()
|
||||
bal1 = node1.getbalance()
|
||||
|
@ -68,9 +68,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
self.fee_tolerance = 2 * self.min_relay_tx_fee / 1000
|
||||
|
||||
self.generate(self.nodes[2], 1)
|
||||
self.sync_all()
|
||||
self.generate(self.nodes[0], 121)
|
||||
self.sync_all()
|
||||
|
||||
self.test_change_position()
|
||||
self.test_simple()
|
||||
@ -128,7 +126,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 50)
|
||||
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
wwatch.unloadwallet()
|
||||
|
||||
@ -492,7 +489,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
# send 12 DASH to msig addr
|
||||
self.nodes[0].sendtoaddress(mSigObj, 12)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
oldBalance = self.nodes[1].getbalance()
|
||||
inputs = []
|
||||
@ -503,7 +499,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
final_psbt = w2.finalizepsbt(signed_psbt['psbt'])
|
||||
self.nodes[2].sendrawtransaction(final_psbt['hex'])
|
||||
self.generate(self.nodes[2], 1)
|
||||
self.sync_all()
|
||||
|
||||
# Make sure funds are received at node1.
|
||||
assert_equal(oldBalance+Decimal('11.0000000'), self.nodes[1].getbalance())
|
||||
@ -565,7 +560,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
signedTx = self.nodes[1].signrawtransactionwithwallet(fundedTx['hex'])
|
||||
self.nodes[1].sendrawtransaction(signedTx['hex'])
|
||||
self.generate(self.nodes[1], 1)
|
||||
self.sync_all()
|
||||
|
||||
# Make sure funds are received at node1.
|
||||
assert_equal(oldBalance+Decimal('511.0000000'), self.nodes[0].getbalance())
|
||||
@ -577,12 +571,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
# Empty node1, send some small coins from node0 to node1.
|
||||
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True)
|
||||
self.generate(self.nodes[1], 1)
|
||||
self.sync_all()
|
||||
|
||||
for _ in range(20):
|
||||
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.01)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# Fund a tx with ~20 small inputs.
|
||||
inputs = []
|
||||
@ -605,12 +597,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
# Again, empty node1, send some small coins from node0 to node1.
|
||||
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True)
|
||||
self.generate(self.nodes[1], 1)
|
||||
self.sync_all()
|
||||
|
||||
for _ in range(20):
|
||||
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.01)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# Fund a tx with ~20 small inputs.
|
||||
oldBalance = self.nodes[0].getbalance()
|
||||
@ -622,7 +612,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
fundedAndSignedTx = self.nodes[1].signrawtransactionwithwallet(fundedTx['hex'])
|
||||
self.nodes[1].sendrawtransaction(fundedAndSignedTx['hex'])
|
||||
self.generate(self.nodes[1], 1)
|
||||
self.sync_all()
|
||||
assert_equal(oldBalance+Decimal('500.19000000'), self.nodes[0].getbalance()) #0.19+block reward
|
||||
|
||||
def test_op_return(self):
|
||||
@ -700,7 +689,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
assert signedtx["complete"]
|
||||
self.nodes[0].sendrawtransaction(signedtx["hex"])
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
wwatch.unloadwallet()
|
||||
|
||||
|
@ -48,7 +48,6 @@ class GetblockstatsTest(BitcoinTestFramework):
|
||||
address = self.nodes[0].get_deterministic_priv_key().address
|
||||
self.nodes[0].sendtoaddress(address=address, amount=10, subtractfeefromamount=True)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
self.nodes[0].sendtoaddress(address=address, amount=10, subtractfeefromamount=True)
|
||||
self.nodes[0].sendtoaddress(address=address, amount=10, subtractfeefromamount=False)
|
||||
|
@ -79,7 +79,6 @@ class NetTest(DashTestFramework):
|
||||
# Create a few getpeerinfo last_block/last_transaction values.
|
||||
self.wallet.send_self_transfer(from_node=self.nodes[0]) # Make a transaction so we can see it in the getpeerinfo results
|
||||
self.generate(self.nodes[1], 1)
|
||||
self.sync_all()
|
||||
time_now = self.mocktime
|
||||
peer_info = [x.getpeerinfo() for x in self.nodes]
|
||||
# Verify last_block and last_transaction keys/values.
|
||||
|
@ -84,7 +84,6 @@ class PSBTTest(BitcoinTestFramework):
|
||||
signed_tx = self.nodes[0].signrawtransactionwithwallet(rawtx['hex'])['hex']
|
||||
txid = self.nodes[0].sendrawtransaction(signed_tx)
|
||||
self.generate(self.nodes[0], 6)
|
||||
self.sync_all()
|
||||
|
||||
# Find the output pos
|
||||
p2sh_pos = -1
|
||||
@ -228,7 +227,6 @@ class PSBTTest(BitcoinTestFramework):
|
||||
txid1 = self.nodes[0].sendtoaddress(node1_addr, 13)
|
||||
txid2 = self.nodes[0].sendtoaddress(node2_addr, 13)
|
||||
blockhash = self.generate(self.nodes[0], 6)[0]
|
||||
self.sync_all()
|
||||
vout1 = find_output(self.nodes[1], txid1, 13, blockhash=blockhash)
|
||||
vout2 = find_output(self.nodes[2], txid2, 13, blockhash=blockhash)
|
||||
|
||||
@ -256,7 +254,6 @@ class PSBTTest(BitcoinTestFramework):
|
||||
finalized = self.nodes[0].finalizepsbt(combined)['hex']
|
||||
self.nodes[0].sendrawtransaction(finalized)
|
||||
self.generate(self.nodes[0], 6)
|
||||
self.sync_all()
|
||||
|
||||
# Make sure change address wallet does not have P2SH innerscript access to results in success
|
||||
# when attempting BnB coin selection
|
||||
@ -395,7 +392,6 @@ class PSBTTest(BitcoinTestFramework):
|
||||
txid4 = self.nodes[0].sendtoaddress(addr4, 5)
|
||||
vout4 = find_output(self.nodes[0], txid4, 5)
|
||||
self.generate(self.nodes[0], 6)
|
||||
self.sync_all()
|
||||
psbt2 = self.nodes[1].createpsbt([{"txid":txid4, "vout":vout4}], {self.nodes[0].getnewaddress():Decimal('4.999')})
|
||||
psbt2 = self.nodes[1].walletprocesspsbt(psbt2)['psbt']
|
||||
psbt2_decoded = self.nodes[0].decodepsbt(psbt2)
|
||||
@ -408,7 +404,6 @@ class PSBTTest(BitcoinTestFramework):
|
||||
addr = self.nodes[1].getnewaddress()
|
||||
txid = self.nodes[0].sendtoaddress(addr, 7)
|
||||
self.generate(self.nodes[0], 6)
|
||||
self.sync_all()
|
||||
vout = find_output(self.nodes[0], txid, 7)
|
||||
psbt = self.nodes[1].createpsbt([{"txid":txid, "vout":vout}], {self.nodes[0].getnewaddress():Decimal('6.999')})
|
||||
analyzed = self.nodes[0].analyzepsbt(psbt)
|
||||
|
@ -72,15 +72,12 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
def run_test(self):
|
||||
self.log.info('prepare some coins for multiple *rawtransaction commands')
|
||||
self.generate(self.nodes[2], 1)
|
||||
self.sync_all()
|
||||
self.generate(self.nodes[0], COINBASE_MATURITY + 1)
|
||||
self.sync_all()
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),1.5)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),1.0)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),5.0)
|
||||
self.sync_all()
|
||||
self.generate(self.nodes[0], 5)
|
||||
self.sync_all()
|
||||
|
||||
self.log.info('Test getrawtransaction on genesis block coinbase returns an error')
|
||||
block = self.nodes[0].getblock(self.nodes[0].getblockhash(0))
|
||||
@ -167,7 +164,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
# make a tx by sending then generate 2 blocks; block1 has the tx in it
|
||||
tx = self.nodes[2].sendtoaddress(self.nodes[1].getnewaddress(), 1)
|
||||
block1, block2 = self.generate(self.nodes[2], 2)
|
||||
self.sync_all()
|
||||
# We should be able to get the raw transaction by providing the correct block
|
||||
gottx = self.nodes[0].getrawtransaction(tx, True, block1)
|
||||
assert_equal(gottx['txid'], tx)
|
||||
@ -218,7 +214,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.2)
|
||||
self.sync_all()
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
assert_equal(self.nodes[2].getbalance(), bal+Decimal('1.20000000')) #node2 has both keys of the 2of2 ms addr., tx should affect the balance
|
||||
|
||||
|
||||
@ -239,7 +234,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
rawTx = self.nodes[0].decoderawtransaction(decTx['hex'])
|
||||
self.sync_all()
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
#THIS IS AN INCOMPLETE FEATURE
|
||||
#NODE2 HAS TWO OF THREE KEY AND THE FUNDS SHOULD BE SPENDABLE AND COUNT AT BALANCE CALCULATION
|
||||
@ -262,7 +256,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
rawTx = self.nodes[0].decoderawtransaction(rawTxSigned['hex'])
|
||||
self.sync_all()
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
assert_equal(self.nodes[0].getbalance(), bal+Decimal('500.00000000')+Decimal('2.19000000')) #block reward + tx
|
||||
|
||||
# 2of2 test for combining transactions
|
||||
@ -282,7 +275,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
rawTx2 = self.nodes[0].decoderawtransaction(decTx['hex'])
|
||||
self.sync_all()
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
assert_equal(self.nodes[2].getbalance(), bal) # the funds of a 2of2 multisig tx should not be marked as spendable
|
||||
|
||||
@ -307,7 +299,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
rawTx2 = self.nodes[0].decoderawtransaction(rawTxComb)
|
||||
self.sync_all()
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
assert_equal(self.nodes[0].getbalance(), bal+Decimal('500.00000000')+Decimal('2.19000000')) #block reward + tx
|
||||
|
||||
|
||||
@ -315,13 +306,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
addr = self.nodes[1].getnewaddress()
|
||||
txid = self.nodes[0].sendtoaddress(addr, 10)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
vout = find_vout_for_address(self.nodes[1], txid, addr)
|
||||
rawTx = self.nodes[1].createrawtransaction([{'txid': txid, 'vout': vout}], {self.nodes[1].getnewaddress(): 9.999})
|
||||
rawTxSigned = self.nodes[1].signrawtransactionwithwallet(rawTx)
|
||||
txId = self.nodes[1].sendrawtransaction(rawTxSigned['hex'])
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# getrawtransaction tests
|
||||
# 1. valid parameters - only supply txid
|
||||
|
@ -33,7 +33,6 @@ class MerkleBlockTest(BitcoinTestFramework):
|
||||
# Add enough mature utxos to the wallet, so that all txs spend confirmed coins
|
||||
self.generate(miniwallet, 5)
|
||||
self.generate(self.nodes[0], COINBASE_MATURITY)
|
||||
self.sync_all()
|
||||
|
||||
chain_height = self.nodes[1].getblockcount()
|
||||
assert_equal(chain_height, 5 + COINBASE_MATURITY)
|
||||
@ -59,7 +58,6 @@ class MerkleBlockTest(BitcoinTestFramework):
|
||||
tx3 = miniwallet.send_self_transfer(from_node=self.nodes[0], utxo_to_spend=txin_spent)
|
||||
txid3 = tx3['txid']
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
txid_spent = txin_spent["txid"]
|
||||
txid_unspent = txid1 # Input was change from txid2, so txid1 should be unspent
|
||||
|
@ -80,7 +80,6 @@ class AvoidReuseTest(BitcoinTestFramework):
|
||||
self.test_immutable()
|
||||
|
||||
self.generate(self.nodes[0], 110)
|
||||
self.sync_all()
|
||||
self.test_change_remains_change(self.nodes[1])
|
||||
reset_balance(self.nodes[1], self.nodes[0].getnewaddress())
|
||||
self.test_sending_from_reused_address_without_avoid_reuse()
|
||||
@ -172,7 +171,6 @@ class AvoidReuseTest(BitcoinTestFramework):
|
||||
|
||||
self.nodes[0].sendtoaddress(fundaddr, 10)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# listunspent should show 1 single, unused 10 btc output
|
||||
assert_unspent(self.nodes[1], total_count=1, total_sum=10, reused_supported=True, reused_count=0)
|
||||
@ -183,7 +181,6 @@ class AvoidReuseTest(BitcoinTestFramework):
|
||||
|
||||
self.nodes[1].sendtoaddress(retaddr, 5)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# listunspent should show 1 single, unused 5 btc output
|
||||
assert_unspent(self.nodes[1], total_count=1, total_sum=5, reused_supported=True, reused_count=0)
|
||||
@ -192,7 +189,6 @@ class AvoidReuseTest(BitcoinTestFramework):
|
||||
|
||||
self.nodes[0].sendtoaddress(fundaddr, 10)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# listunspent should show 2 total outputs (5, 10 btc), one unused (5), one reused (10)
|
||||
assert_unspent(self.nodes[1], total_count=2, total_sum=15, reused_count=1, reused_sum=10)
|
||||
@ -226,7 +222,6 @@ class AvoidReuseTest(BitcoinTestFramework):
|
||||
|
||||
self.nodes[0].sendtoaddress(fundaddr, 10)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# listunspent should show 1 single, unused 10 btc output
|
||||
assert_unspent(self.nodes[1], total_count=1, total_sum=10, reused_supported=True, reused_count=0)
|
||||
@ -235,7 +230,6 @@ class AvoidReuseTest(BitcoinTestFramework):
|
||||
|
||||
self.nodes[1].sendtoaddress(retaddr, 5)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# listunspent should show 1 single, unused 5 btc output
|
||||
assert_unspent(self.nodes[1], total_count=1, total_sum=5, reused_supported=True, reused_count=0)
|
||||
@ -245,7 +239,6 @@ class AvoidReuseTest(BitcoinTestFramework):
|
||||
if not self.options.descriptors:
|
||||
self.nodes[0].sendtoaddress(fundaddr, 10)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# listunspent should show 2 total outputs (5, 10 btc), one unused (5), one reused (10)
|
||||
assert_unspent(self.nodes[1], total_count=2, total_sum=15, reused_count=1, reused_sum=10)
|
||||
@ -288,7 +281,6 @@ class AvoidReuseTest(BitcoinTestFramework):
|
||||
self.nodes[0].sendtoaddress(new_addr, 1)
|
||||
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# send transaction that should not use all the available outputs
|
||||
# per the current coin selection algorithm
|
||||
@ -320,7 +312,6 @@ class AvoidReuseTest(BitcoinTestFramework):
|
||||
self.nodes[0].sendtoaddress(new_addr, 1)
|
||||
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# Sending a transaction that is smaller than each one of the
|
||||
# available outputs
|
||||
@ -349,7 +340,6 @@ class AvoidReuseTest(BitcoinTestFramework):
|
||||
self.nodes[0].sendtoaddress(new_addr, 1)
|
||||
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# Sending a transaction that needs to use the full groups
|
||||
# of 100 inputs but also the incomplete group of 2 inputs.
|
||||
|
@ -177,7 +177,6 @@ class WalletBackupTest(BitcoinTestFramework):
|
||||
|
||||
# Generate 101 more blocks, so any fees paid mature
|
||||
self.generate(self.nodes[3], COINBASE_MATURITY + 1)
|
||||
self.sync_all()
|
||||
|
||||
balance0 = self.nodes[0].getbalance()
|
||||
balance1 = self.nodes[1].getbalance()
|
||||
|
@ -71,10 +71,8 @@ class WalletTest(BitcoinTestFramework):
|
||||
|
||||
self.log.info("Mining blocks ...")
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
self.generate(self.nodes[1], 1)
|
||||
self.generatetoaddress(self.nodes[1], COINBASE_MATURITY + 1, ADDRESS_WATCHONLY)
|
||||
self.sync_all()
|
||||
|
||||
if not self.options.descriptors:
|
||||
# Tests legacy watchonly behavior which is not present (and does not need to be tested) in descriptor wallets
|
||||
@ -201,7 +199,6 @@ class WalletTest(BitcoinTestFramework):
|
||||
# test_balances(fee_node_1=Decimal('0.02')) # disabled, no RBF in Dash
|
||||
|
||||
self.generatetoaddress(self.nodes[1], 1, ADDRESS_WATCHONLY)
|
||||
self.sync_all()
|
||||
|
||||
# balances are correct after the transactions are confirmed
|
||||
balance_node0 = Decimal('969.99') # node 1's send plus change from node 0's send
|
||||
@ -215,7 +212,6 @@ class WalletTest(BitcoinTestFramework):
|
||||
txs = create_transactions(self.nodes[1], self.nodes[0].getnewaddress(), Decimal('29.98'), [Decimal('0.01')])
|
||||
self.nodes[1].sendrawtransaction(txs[0]['hex'])
|
||||
self.generatetoaddress(self.nodes[1], 2, ADDRESS_WATCHONLY)
|
||||
self.sync_all()
|
||||
|
||||
# getbalance with a minconf incorrectly excludes coins that have been spent more recently than the minconf blocks ago
|
||||
# TODO: fix getbalance tracking of coin spentness depth
|
||||
@ -279,7 +275,6 @@ class WalletTest(BitcoinTestFramework):
|
||||
self.sync_blocks()
|
||||
self.nodes[1].sendrawtransaction(tx_orig)
|
||||
self.generatetoaddress(self.nodes[1], 1, ADDRESS_WATCHONLY)
|
||||
self.sync_all()
|
||||
assert_equal(self.nodes[0].getbalance(minconf=0), total_amount + 1) # The reorg recovered our fee of 1 coin
|
||||
|
||||
|
||||
|
@ -46,7 +46,6 @@ class WalletGroupTest(BitcoinTestFramework):
|
||||
[self.nodes[0].sendtoaddress(addr, 0.5) for addr in addrs]
|
||||
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# For each node, send 0.2 coins back to 0;
|
||||
# - node[1] should pick one 0.5 UTXO and leave the rest
|
||||
@ -114,7 +113,6 @@ class WalletGroupTest(BitcoinTestFramework):
|
||||
self.nodes[0].sendtoaddress(addr_aps, 1.0)
|
||||
self.nodes[0].sendtoaddress(addr_aps, 1.0)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
with self.nodes[3].assert_debug_log(['Fee non-grouped = 225, grouped = 372, using grouped']):
|
||||
txid4 = self.nodes[3].sendtoaddress(self.nodes[0].getnewaddress(), 0.1)
|
||||
tx4 = self.nodes[3].getrawtransaction(txid4, True)
|
||||
@ -126,7 +124,6 @@ class WalletGroupTest(BitcoinTestFramework):
|
||||
addr_aps2 = self.nodes[3].getnewaddress()
|
||||
[self.nodes[0].sendtoaddress(addr_aps2, 1.0) for _ in range(5)]
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
with self.nodes[3].assert_debug_log(['Fee non-grouped = 519, grouped = 813, using non-grouped']):
|
||||
txid5 = self.nodes[3].sendtoaddress(self.nodes[0].getnewaddress(), 2.95)
|
||||
tx5 = self.nodes[3].getrawtransaction(txid5, True)
|
||||
@ -140,7 +137,6 @@ class WalletGroupTest(BitcoinTestFramework):
|
||||
addr_aps3 = self.nodes[4].getnewaddress()
|
||||
[self.nodes[0].sendtoaddress(addr_aps3, 1.0) for _ in range(5)]
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
with self.nodes[4].assert_debug_log(['Fee non-grouped = 519, grouped = 813, using grouped']):
|
||||
txid6 = self.nodes[4].sendtoaddress(self.nodes[0].getnewaddress(), 2.95)
|
||||
tx6 = self.nodes[4].getrawtransaction(txid6, True)
|
||||
@ -163,7 +159,6 @@ class WalletGroupTest(BitcoinTestFramework):
|
||||
signed_tx = self.nodes[0].signrawtransactionwithwallet(funded_tx['hex'])
|
||||
self.nodes[0].sendrawtransaction(signed_tx['hex'])
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# Check that we can create a transaction that only requires ~100 of our
|
||||
# utxos, without pulling in all outputs and creating a transaction that
|
||||
|
@ -177,7 +177,6 @@ class ImportRescanTest(BitcoinTestFramework):
|
||||
self.nodes[0].getblockheader(self.nodes[0].getbestblockhash())["time"] + TIMESTAMP_WINDOW + 1,
|
||||
)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# For each variation of wallet key import, invoke the import RPC and
|
||||
# check the results from getbalance and listtransactions.
|
||||
|
@ -427,10 +427,8 @@ class ImportDescriptorsTest(BitcoinTestFramework):
|
||||
assert_equal(wmulti_priv.getwalletinfo()['keypoolsize'], 1000)
|
||||
txid = w0.sendtoaddress(addr, 10)
|
||||
self.generate(self.nodes[0], 6)
|
||||
self.sync_all()
|
||||
wmulti_priv.sendtoaddress(w0.getnewaddress(), 8) # uses change 1
|
||||
self.generate(self.nodes[0], 6)
|
||||
self.sync_all()
|
||||
|
||||
self.nodes[1].createwallet(wallet_name="wmulti_pub", disable_private_keys=True, blank=True, descriptors=True)
|
||||
wmulti_pub = self.nodes[1].get_wallet_rpc("wmulti_pub")
|
||||
@ -468,7 +466,6 @@ class ImportDescriptorsTest(BitcoinTestFramework):
|
||||
vout2 = find_vout_for_address(self.nodes[0], txid2, addr2)
|
||||
|
||||
self.generate(self.nodes[0], 6)
|
||||
self.sync_all()
|
||||
assert_equal(wmulti_pub.getbalance(), wmulti_priv.getbalance())
|
||||
|
||||
# Make sure that descriptor wallets containing multiple xpubs in a single descriptor load correctly
|
||||
@ -559,7 +556,6 @@ class ImportDescriptorsTest(BitcoinTestFramework):
|
||||
addr = multi_priv_big.getnewaddress("")
|
||||
w0.sendtoaddress(addr, 10)
|
||||
self.generate(self.nodes[0], 6)
|
||||
self.sync_all()
|
||||
# It is standard and would relay.
|
||||
txid = multi_priv_big.sendtoaddress(w0.getnewaddress(), 10, "", "",
|
||||
True)
|
||||
|
@ -27,8 +27,6 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
||||
self.log.info("Mining blocks...")
|
||||
self.generate(self.nodes[0], COINBASE_MATURITY + 1)
|
||||
|
||||
self.sync_all()
|
||||
|
||||
# address
|
||||
address1 = self.nodes[0].getnewaddress()
|
||||
# pubkey
|
||||
|
@ -44,7 +44,6 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||
True)
|
||||
# Bury Tx under 10 block so it will be returned by listreceivedbyaddress
|
||||
self.generate(self.nodes[1], 10)
|
||||
self.sync_all()
|
||||
assert_array_result(self.nodes[1].listreceivedbyaddress(),
|
||||
{"address": addr},
|
||||
{"address": addr, "label": "", "amount": Decimal("0.1"), "confirmations": 10, "txids": [txid, ]})
|
||||
@ -79,7 +78,6 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||
other_addr = self.nodes[1].getnewaddress()
|
||||
txid2 = self.nodes[0].sendtoaddress(other_addr, 0.1)
|
||||
self.generate(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
# Same test as above should still pass
|
||||
expected = {"address": addr, "label": "", "amount": Decimal("0.1"), "confirmations": 11, "txids": [txid, ]}
|
||||
res = self.nodes[1].listreceivedbyaddress(0, True, True, True, addr)
|
||||
@ -116,7 +114,6 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||
|
||||
# Bury Tx under 10 block so it will be returned by the default getreceivedbyaddress
|
||||
self.generate(self.nodes[1], 10)
|
||||
self.sync_all()
|
||||
balance = self.nodes[1].getreceivedbyaddress(addr)
|
||||
assert_equal(balance, Decimal("0.1"))
|
||||
|
||||
@ -145,7 +142,6 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||
assert_equal(balance, balance_by_label)
|
||||
|
||||
self.generate(self.nodes[1], 10)
|
||||
self.sync_all()
|
||||
# listreceivedbylabel should return updated received list
|
||||
assert_array_result(self.nodes[1].listreceivedbylabel(),
|
||||
{"label": label},
|
||||
|
@ -90,7 +90,6 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||
self.nodes[0].importaddress(multisig["redeemScript"], "watchonly", False, True)
|
||||
txid = self.nodes[1].sendtoaddress(multisig["address"], 0.1)
|
||||
self.generate(self.nodes[1], 1)
|
||||
self.sync_all()
|
||||
assert_equal(len(self.nodes[0].listtransactions(label="watchonly", include_watchonly=True)), 1)
|
||||
assert_equal(len(self.nodes[0].listtransactions(dummy="watchonly", include_watchonly=True)), 1)
|
||||
assert len(self.nodes[0].listtransactions(label="watchonly", count=100, include_watchonly=False)) == 0
|
||||
|
Loading…
Reference in New Issue
Block a user