-
Notifications
You must be signed in to change notification settings - Fork 36.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpc: Return fee and vsize from testmempoolaccept #19940
Conversation
@rajarshimaitra @MarcoFalke @jnewbery as we discussed on #19093 :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
concept ACK, would like less-magical tests
utACK 4943a13 (once release notes have been updated) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 4943a13
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need to truncate the digits of the btc amount?
@@ -91,20 +92,22 @@ def run_test(self): | |||
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_0))) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated nit: What happens if fee
was made a Decimal
as opposed to float
when defined?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
vsize
andfees
object (similar togetmempoolentry
) when the test accept is successful. Updates release-notes.md.