diff options
| author | MarcoFalke <[email protected]> | 2020-03-30 19:06:40 -0400 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2020-03-30 19:06:43 -0400 |
| commit | 965c0c37d54c727bee50920fdfa62f8174a94280 (patch) | |
| tree | 34451b907b6cf753b939777ec5ed1efe542bd5e5 | |
| parent | Merge #18334: test: Add basic test for BIP 37 (diff) | |
| parent | test: listsinceblock block height checks (diff) | |
| download | discoin-965c0c37d54c727bee50920fdfa62f8174a94280.tar.xz discoin-965c0c37d54c727bee50920fdfa62f8174a94280.zip | |
Merge #18420: test: listsinceblock block height checks
83e1d92413e262e6a876336ec433a6fbc335223a test: listsinceblock block height checks (Jon Atack)
Pull request description:
This is the second commit of #17535.
This PR extends a listsinceblock test to check the new transaction 'blockheight' field recently added in #17437. It also cleans up code in the test function without changing or removing existing checks.
ACKs for top commit:
fjahr:
tested ACK 83e1d92413e262e6a876336ec433a6fbc335223a
ryanofsky:
Code review ACK 83e1d92413e262e6a876336ec433a6fbc335223a. Nice test improvements!
Tree-SHA512: 92874b49a3bc0236500495f32dfcf683e1971ca3d4c51702c69ed4ce7dfce21273754f02f93d1243d73793701d9fdf49e14b149477cd249cbbd9e4e8d5bd49f8
| -rwxr-xr-x | test/functional/wallet_listsinceblock.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/test/functional/wallet_listsinceblock.py b/test/functional/wallet_listsinceblock.py index 229eda980..6d51ca6c9 100755 --- a/test/functional/wallet_listsinceblock.py +++ b/test/functional/wallet_listsinceblock.py @@ -111,23 +111,21 @@ class ListSinceBlockTest(BitcoinTestFramework): senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1) # generate on both sides - lastblockhash = self.nodes[1].generate(6)[5] - self.nodes[2].generate(7) - self.log.debug('lastblockhash={}'.format(lastblockhash)) + nodes1_last_blockhash = self.nodes[1].generate(6)[-1] + nodes2_first_blockhash = self.nodes[2].generate(7)[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(lastblockhash) should now include tx, as seen from nodes[0] - lsbres = self.nodes[0].listsinceblock(lastblockhash) - found = False - for tx in lsbres['transactions']: - if tx['txid'] == senttx: - found = True - break - assert found + # listsinceblock(nodes1_last_blockhash) should now include tx as seen from nodes[0] + # and return the block height which listsinceblock now exposes since a5e7795. + transactions = self.nodes[0].listsinceblock(nodes1_last_blockhash)['transactions'] + found = next(tx for tx in transactions if tx['txid'] == senttx) + assert_equal(found['blockheight'], self.nodes[0].getblockheader(nodes2_first_blockhash)['height']) def test_double_spend(self): ''' |