rpc: Return fee and vsize from testmempoolaccept#19940
rpc: Return fee and vsize from testmempoolaccept#19940fanquake merged 2 commits intobitcoin:masterfrom
Conversation
|
@rajarshimaitra @MarcoFalke @jnewbery as we discussed on #19093 :) |
instagibbs
left a comment
There was a problem hiding this comment.
concept ACK, would like less-magical tests
|
utACK 4943a1392c33cd5ac985e753d9cc728b794c5752 (once release notes have been updated) |
fjahr
left a comment
There was a problem hiding this comment.
utACK 4943a1392c33cd5ac985e753d9cc728b794c5752
I agree that tests could be better but I would also be fine with merging as is.
Return fee and vsize if tx would pass ATMP.
4943a13 to
2233a93
Compare
|
ACK 4189588 thanks it's a solid improvement for the next contributor wanting to touch it :) |
4189588 to
23c35bf
Compare
|
thank you @instagibbs! I'm so sorry but I just realized I forgot to apply it to p2p_segwit.py 😅 need you to take another look oops... @jnewbery @fjahr this is ready for review again - updated release notes + rpc and added a util for getting vsize in test_framework/messages.py |
|
reACK 23c35bf |
|
utACK 23c35bf |
|
utACK 23c35bf |
maflcko
left a comment
There was a problem hiding this comment.
Nice. Concept ACK! Left some feedback on the tests.
| locktime=node.getblockcount() + 2000, # Can be anything | ||
| ))['hex'] | ||
| tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_final))) | ||
| fee_expected = int(coin['amount']) - output_amount |
There was a problem hiding this comment.
why does this need to truncate the digits of the btc amount?
| txid_0 = tx.rehash() | ||
| self.check_mempool_result( | ||
| result_expected=[{'txid': txid_0, 'allowed': True}], | ||
| result_expected=[{'txid': txid_0, 'allowed': True, 'vsize': tx.get_vsize(), 'fees': {'base': Decimal(str(fee))}}], |
There was a problem hiding this comment.
unrelated nit: What happens if fee was made a Decimal as opposed to float when defined?
| fee_expected = int(coin['amount']) - output_amount | ||
| self.check_mempool_result( | ||
| result_expected=[{'txid': tx.rehash(), 'allowed': True}], | ||
| result_expected=[{'txid': tx.rehash(), 'allowed': True, 'vsize': tx.get_vsize(), 'fees': {'base': Decimal(str(fee_expected))}}], |
There was a problem hiding this comment.
Same
(This is my fault for using float in the first place, but now that Decimal is imported, might as well use it everywhere)
23c35bf [test] add get_vsize util for more programmatic testing (gzhao408) 2233a93 [rpc] Return fee and vsize from testmempoolaccept (codeShark149) Pull request description: From bitcoin#19093 and resolves bitcoin#19057. Difference from bitcoin#19093: return `vsize` and `fees` object (similar to `getmempoolentry`) when the test accept is successful. Updates release-notes.md. ACKs for top commit: jnewbery: utACK 23c35bf fjahr: utACK 23c35bf instagibbs: reACK bitcoin@23c35bf Tree-SHA512: dcb81b7b817a4684e9076bc5d427a6f2d549d2edc66544e718260c4b5f8f1d5ae1d47b754175e9f0c8a3bd8371ce116c2dca0583588d513a7d733d5d614f2b04
88197b0 [doc] release notes for max fee checking (gzhao408) c201d73 style and nits for fee-checking in BroadcastTransaction (gzhao408) Pull request description: Pretty trivial... addresses some tiny comments from #19339. Also fixes a docs typo from #19940 and adds a release note about the error message change for testmempoolaccept. ACKs for top commit: achow101: ACK 88197b0 MarcoFalke: cr re-ACK 88197b0 Tree-SHA512: fff16d731426b9b4db5222df02633983402f4c7241551eec98bb1554145dbdc132f40ed8ca4abd5edcebe1f4d1e879fb6d11bd91730604f6552c10cdf65706a1
88197b0 [doc] release notes for max fee checking (gzhao408) c201d73 style and nits for fee-checking in BroadcastTransaction (gzhao408) Pull request description: Pretty trivial... addresses some tiny comments from bitcoin#19339. Also fixes a docs typo from bitcoin#19940 and adds a release note about the error message change for testmempoolaccept. ACKs for top commit: achow101: ACK 88197b0 MarcoFalke: cr re-ACK 88197b0 Tree-SHA512: fff16d731426b9b4db5222df02633983402f4c7241551eec98bb1554145dbdc132f40ed8ca4abd5edcebe1f4d1e879fb6d11bd91730604f6552c10cdf65706a1
Summary: Return fee and size if tx would pass ATMP. This is a backport of [[bitcoin/bitcoin#19940 | core#19940]] D1635 introduced `CTransaction.billable_size`, so use it instead of adding a new identical `get_size` method. Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10279
From #19093 and resolves #19057.
Difference from #19093: return
vsizeandfeesobject (similar togetmempoolentry) when the test accept is successful. Updates release-notes.md.