test: Implicitly sync after generate*, unless opted out

This commit is contained in:
MarcoFalke
2020-11-10 18:02:31 +01:00
parent 5574881ce3
commit facc352648
46 changed files with 144 additions and 175 deletions

View File

@ -54,7 +54,6 @@ class ListSinceBlockTest(BitcoinTestFramework):
blockhash, = self.generate(self.nodes[2], 1)
blockheight = self.nodes[2].getblockheader(blockhash)['height']
self.sync_all()
txs = self.nodes[0].listtransactions()
assert_array_result(txs, {"txid": txid}, {
@ -99,7 +98,6 @@ class ListSinceBlockTest(BitcoinTestFramework):
self.log.info("Test target_confirmations")
blockhash, = self.generate(self.nodes[2], 1)
blockheight = self.nodes[2].getblockheader(blockhash)['height']
self.sync_all()
assert_equal(
self.nodes[0].getblockhash(0),
@ -147,14 +145,11 @@ class ListSinceBlockTest(BitcoinTestFramework):
senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1)
# generate on both sides
nodes1_last_blockhash = self.generate(self.nodes[1], 6)[-1]
nodes2_first_blockhash = self.generate(self.nodes[2], 7)[0]
nodes1_last_blockhash = self.generate(self.nodes[1], 6, sync_fun=lambda: self.sync_all(self.nodes[:2]))[-1]
nodes2_first_blockhash = self.generate(self.nodes[2], 7, sync_fun=lambda: self.sync_all(self.nodes[2:]))[0]
self.log.debug("nodes[1] last blockhash = {}".format(nodes1_last_blockhash))
self.log.debug("nodes[2] first blockhash = {}".format(nodes2_first_blockhash))
self.sync_all(self.nodes[:2])
self.sync_all(self.nodes[2:])
self.join_network()
# listsinceblock(nodes1_last_blockhash) should now include tx as seen from nodes[0]
@ -236,8 +231,8 @@ class ListSinceBlockTest(BitcoinTestFramework):
self.nodes[2].createrawtransaction(utxo_dicts, recipient_dict2))['hex'])
# generate on both sides
lastblockhash = self.generate(self.nodes[1], 3)[2]
self.generate(self.nodes[2], 4)
lastblockhash = self.generate(self.nodes[1], 3, sync_fun=self.no_op)[2]
self.generate(self.nodes[2], 4, sync_fun=self.no_op)
self.join_network()
@ -308,7 +303,7 @@ class ListSinceBlockTest(BitcoinTestFramework):
txid1 = self.nodes[1].sendrawtransaction(signedtx)
# generate bb1-bb2 on right side
self.generate(self.nodes[2], 2)
self.generate(self.nodes[2], 2, sync_fun=self.no_op)
# send from nodes[2]; this will end up in bb3
txid2 = self.nodes[2].sendrawtransaction(signedtx)
@ -316,8 +311,8 @@ class ListSinceBlockTest(BitcoinTestFramework):
assert_equal(txid1, txid2)
# generate on both sides
lastblockhash = self.generate(self.nodes[1], 3)[2]
self.generate(self.nodes[2], 2)
lastblockhash = self.generate(self.nodes[1], 3, sync_fun=self.no_op)[2]
self.generate(self.nodes[2], 2, sync_fun=self.no_op)
self.join_network()