Skip to content
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

Merged
merged 2 commits into from
Sep 19, 2020

Conversation

glozow
Copy link
Member

@glozow glozow commented Sep 11, 2020

From #19093 and resolves #19057.

Difference from #19093: return vsize and fees object (similar to getmempoolentry) when the test accept is successful. Updates release-notes.md.

@glozow
Copy link
Member Author

glozow commented Sep 11, 2020

@rajarshimaitra @MarcoFalke @jnewbery as we discussed on #19093 :)

doc/release-notes.md Outdated Show resolved Hide resolved
Copy link
Member

@instagibbs instagibbs left a 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

test/functional/mempool_accept.py Outdated Show resolved Hide resolved
test/functional/mempool_accept.py Outdated Show resolved Hide resolved
@jnewbery
Copy link
Contributor

utACK 4943a13 (once release notes have been updated)

Copy link
Contributor

@fjahr fjahr left a 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.

src/rpc/rawtransaction.cpp Outdated Show resolved Hide resolved
Return fee and vsize if tx would pass ATMP.
@glozow glozow force-pushed the rpc-testmempoolaccept-fee branch from 4943a13 to 2233a93 Compare September 16, 2020 13:33
@instagibbs
Copy link
Member

ACK 4189588

thanks it's a solid improvement for the next contributor wanting to touch it :)

@glozow glozow force-pushed the rpc-testmempoolaccept-fee branch from 4189588 to 23c35bf Compare September 16, 2020 14:31
@glozow
Copy link
Member Author

glozow commented Sep 16, 2020

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

@instagibbs
Copy link
Member

reACK 23c35bf

@fjahr
Copy link
Contributor

fjahr commented Sep 16, 2020

utACK 23c35bf

@jnewbery
Copy link
Contributor

utACK 23c35bf

@fanquake fanquake merged commit c30f79d into bitcoin:master Sep 19, 2020
Copy link
Member

@maflcko maflcko left a 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
Copy link
Member

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))}}],
Copy link
Member

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))}}],
Copy link
Member

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)

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Sep 20, 2020
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
fanquake added a commit that referenced this pull request Oct 14, 2020
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
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 15, 2020
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
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 8, 2021
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

testmempoolaccept should return the fee
7 participants