Follow-up to PR #17437.
Add block height test, expected fields tests, logging, and correct header docstring in listsinceblock.py, and improve the release notes.
110 | @@ -111,23 +111,25 @@ def test_reorg(self): 111 | senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1) 112 | 113 | # generate on both sides 114 | - lastblockhash = self.nodes[1].generate(6)[5] 115 | - self.nodes[2].generate(7) 116 | - self.log.info('lastblockhash=%s' % (lastblockhash)) 117 | + lastblockhash_nodes_1 = self.nodes[1].generate(6)[5] 118 | + lastblockhash_nodes_2 = self.nodes[2].generate(7)[0]
Isn't firstblockhash more accurate here ?
Good point! Done.
ACK 38e94bc modulo fixing only comment.
I think you can also harden wallet_reorgsrestore, wallet_listtransactions with block height assertions.
0 | @@ -1,5 +1,6 @@ 1 | Low-level RPC Changes 2 | === 3 | 4 | -- The RPC gettransaction, listtransactions and listsinceblock responses now also 5 | -includes the height of the block that contains the wallet transaction, if any. 6 | +- The RPC gettransaction, listtransactions, and listsinceblock responses now 7 | +include the height of the block that contains the wallet transaction, if any. 8 | +Please refer to the RPC help of these calls for details.
As usual? :smile:
As per @laanwj suggestion in IRC a few months ago: Release notes should refer to the RPC help for details instead of substituting for full documentation. Example: "Please refer to the RPC help of getbalances for details."
The commit also fixes a grammar error: s/includes/include/
(Thanks for reviewing :)
Maybe instead of mentioning it in every bullet point, once per heading is enough?
Done
Concept ACK
135 | if tx['txid'] == senttx: 136 | - found = True 137 | + found = tx 138 | break 139 | - assert found 140 | + assert_equal(found['blockheight'],
This will throw NameError if no match is found above? :)
Could add found = {'blockheight': 0} if you would prefer it to fail with AssertionError: not(0 == 103) instead of NameError: name 'found' is not defined
Perhaps found = None and then assert found is not None on the line before the assert_equal? :)
You've added 2 lines! :smile: ... SGTM, done
nit: You can also use next(), as we do in other tests.
@MarcoFalke something like this?
- found = None
- for tx in transactions:
- if tx['txid'] == senttx:
- found = tx
- break
- assert found is not None
+ found = next(tx for tx in transactions if tx['txid'] == senttx)
Concept ACK
110 | @@ -111,23 +111,22 @@ def test_reorg(self): 111 | senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1) 112 | 113 | # generate on both sides 114 | - lastblockhash = self.nodes[1].generate(6)[5] 115 | - self.nodes[2].generate(7) 116 | - self.log.info('lastblockhash=%s' % (lastblockhash)) 117 | + nodes1_last_blockhash = self.nodes[1].generate(6)[5]
ecbd8a2526122fc6bd472b702580ebb221df00d5
nit, pythonic last [-1]?
done
0 | @@ -1,5 +1,5 @@ 1 | Low-level RPC Changes 2 | === 3 | 4 | -- The RPC gettransaction, listtransactions and listsinceblock responses now also 5 | -includes the height of the block that contains the wallet transaction, if any. 6 | +- The RPC gettransaction, listtransactions, and listsinceblock responses now
4e206a89383eaca83acbbf9533e4aec62fe9fee7
Comma before "and" is not needed here? TIL both ways are correct but do you think this is more correct?
I grew up being taught to not use the Oxford comma, and it could be considered less aesthetic, but it seems to have made a resurgence. It has the benefit of reducing potential confusion in writing that needs to be clear. Without it, meanings of sentences can change. So it can be a good idea to use it for documentation writing. That said, I don't feel strongly about it here :)
https://www.rd.com/culture/oxford-comma-proper-use/ https://thewritelife.com/is-the-oxford-comma-necessary/ https://thewritepractice.com/why-you-need-to-be-using-oxford-commas/ https://en.wikipedia.org/wiki/Serial_comma
ACK d28907423344a6bafb09ebd422a20cd11ff0cf41, I think 27450e0 could be squashed in ecbd8a2 or d289074.
and correct the header docstring.
ACK 38e94bc modulo fixing only comment.
I think you can also harden
wallet_reorgsrestore,wallet_listtransactionswith block height assertions. @ariard thank you, I will look at those in a follow-up. @practicalswift, @MarcoFalke, any further suggestions here?
80 | @@ -81,8 +81,9 @@ Updated settings 81 | Updated RPCs 82 | ------------ 83 | 84 | -Note: some low-level RPC changes mainly useful for testing are described in the 85 | -Low-level Changes section below. 86 | +Please refer to the help of the relevant RPC for more details on an update 87 | +below. Note that some low-level RPC changes mainly useful for testing are
nit:
below. Some low-level RPC changes mainly useful for testing are
done
Updated the release notes commit with @MarcoFalke's suggestion and rebased; no other changes.