test: listsinceblock block height checks

This commit is contained in:
Jon Atack 2019-11-20 16:20:33 +01:00
parent ac579ada7e
commit 83e1d92413
No known key found for this signature in database
GPG Key ID: 4F5721B3D0E3921D

View File

@ -111,23 +111,21 @@ class ListSinceBlockTest(BitcoinTestFramework):
senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1) senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1)
# generate on both sides # generate on both sides
lastblockhash = self.nodes[1].generate(6)[5] nodes1_last_blockhash = self.nodes[1].generate(6)[-1]
self.nodes[2].generate(7) nodes2_first_blockhash = self.nodes[2].generate(7)[0]
self.log.debug('lastblockhash={}'.format(lastblockhash)) 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.sync_all(self.nodes[2:]) self.sync_all(self.nodes[2:])
self.join_network() self.join_network()
# listsinceblock(lastblockhash) should now include tx, as seen from nodes[0] # listsinceblock(nodes1_last_blockhash) should now include tx as seen from nodes[0]
lsbres = self.nodes[0].listsinceblock(lastblockhash) # and return the block height which listsinceblock now exposes since a5e7795.
found = False transactions = self.nodes[0].listsinceblock(nodes1_last_blockhash)['transactions']
for tx in lsbres['transactions']: found = next(tx for tx in transactions if tx['txid'] == senttx)
if tx['txid'] == senttx: assert_equal(found['blockheight'], self.nodes[0].getblockheader(nodes2_first_blockhash)['height'])
found = True
break
assert found
def test_double_spend(self): def test_double_spend(self):
''' '''