Skip to content

Commit 83e1d92

Browse files
committed
test: listsinceblock block height checks
1 parent ac579ad commit 83e1d92

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

test/functional/wallet_listsinceblock.py

+9-11
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,21 @@ def test_reorg(self):
111111
senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1)
112112

113113
# generate on both sides
114-
lastblockhash = self.nodes[1].generate(6)[5]
115-
self.nodes[2].generate(7)
116-
self.log.debug('lastblockhash={}'.format(lastblockhash))
114+
nodes1_last_blockhash = self.nodes[1].generate(6)[-1]
115+
nodes2_first_blockhash = self.nodes[2].generate(7)[0]
116+
self.log.debug("nodes[1] last blockhash = {}".format(nodes1_last_blockhash))
117+
self.log.debug("nodes[2] first blockhash = {}".format(nodes2_first_blockhash))
117118

118119
self.sync_all(self.nodes[:2])
119120
self.sync_all(self.nodes[2:])
120121

121122
self.join_network()
122123

123-
# listsinceblock(lastblockhash) should now include tx, as seen from nodes[0]
124-
lsbres = self.nodes[0].listsinceblock(lastblockhash)
125-
found = False
126-
for tx in lsbres['transactions']:
127-
if tx['txid'] == senttx:
128-
found = True
129-
break
130-
assert found
124+
# listsinceblock(nodes1_last_blockhash) should now include tx as seen from nodes[0]
125+
# and return the block height which listsinceblock now exposes since a5e7795.
126+
transactions = self.nodes[0].listsinceblock(nodes1_last_blockhash)['transactions']
127+
found = next(tx for tx in transactions if tx['txid'] == senttx)
128+
assert_equal(found['blockheight'], self.nodes[0].getblockheader(nodes2_first_blockhash)['height'])
131129

132130
def test_double_spend(self):
133131
'''

0 commit comments

Comments
 (0)