-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Fix issue with conflicted mempool tx in listsinceblock #17258
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
Fix issue with conflicted mempool tx in listsinceblock #17258
Conversation
|
Was the intention to cherry-pick / attribute the original author here? You could add a |
1d3f144 to
700a288
Compare
|
Thanks @fanquake. It was extra work to rebase original commits since |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
instagibbs
left a comment
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.
Looks ok enough. Test seems to make sense too, but I'm not the guy to ask about listsinceblock.
@kallewoof I recollect you filing issues on the topic, could you tag in?
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.
That should already be in test_framework.messages module
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.
Right. 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.
why 6?
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.
This was copied from the test_reorg test, but that doesn't seem necessary here, so knocked it down to 1.
listsinceblock now checks that returned transactions are not conflicting with any transactions that are filtered out by the given blockhash Co-Authored-By: Michael Chrostowski <[email protected]>
676991e to
436ad43
Compare
|
utACK 436ad43 but someone with more history with the RPC call should review |
|
utACK 436ad43 |
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.
I'm not qualifed to give an ACK here but 436ad43 appears reasonable. Built/ran tests/verified that this test fails without the change in rpcwallet.cpp:
File "./wallet_listsinceblock.py", line 340, in double_spends_filtered
assert_equal(original_found, False)Feel free to ignore the comments below.
| CWalletTx tx = pairWtx.second; | ||
|
|
||
| if (depth == -1 || tx.GetDepthInMainChain(*locked_chain) < depth) { | ||
| if (depth == -1 || abs(tx.GetDepthInMainChain(*locked_chain)) < depth) { |
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.
Perhaps document in the code here why this works. To borrow from the original author, that this takes advantage of CMerkleTx::GetDepthInMainChain() returning a negative value for conflicted transactions. The negative value represents the depth of the transaction with which it is conflicted. Taking abs() of this allows using the same logic for filtering un-conflicted transactions to filter the conflicted ones.
| connect_nodes, | ||
| ) | ||
|
|
||
| from decimal import Decimal |
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.
nit: IIRC the codebase convention is to place language imports above codebase ones
|
LGTM 436ad43 |
436ad43 Fix issue with conflicted mempool tx in listsinceblock (Adam Jonas) Pull request description: Closes #8752 by bringing back abandoned #10470. This now checks that returned transactions are not conflicting with any transactions that are filtered out by the given blockhash and add a functional test to prevent this in the future. For more context, #8757 was closed in favor of #10470. ACKs for top commit: instagibbs: utACK 436ad43 kallewoof: utACK 436ad43 jonatack: I'm not qualifed to give an ACK here but 436ad43 appears reasonable. Built/ran tests/verified that this test fails without the change in rpcwallet.cpp: Tree-SHA512: 63d75cd3d3f19fc84dc38899b200c96179b82b24db263cd0116ee5b715265be647157855c2e35912d2fbc49c7b37db9375d6aab0ac672f0f09bece8431de5ea9
|
I'm still confused as to why you put your name on my work. Good job getting the fix in. @adamjonas I see now this was not possible with a rebase and my comment was out of line. Thanks for the attribution! |
You didn't respond to requests on your pull request for two years, that's probably why. And your name is on the commit, it just now has another user's name as well, which is fair since they did work to get it merged after all. |
I don't think that complaint is warranted. Looking at the commit it's attributed in every way possible. It's also bad etiquette to change a commit and not add your own name, because it's no longer the original work. If you disagree with this kind of use of your code, please do not contribute it under the MIT license (even implicitly by contributing it a repository licensed thus) in the first place. |
Basically agree, but it is possible to give credit beyond adding the original author name to metadata. You can say, "This idea was originally proposed by [person] in [url]", "This was originally implemented by [person] at [url] and the following changes have been made here [...]" |
That happened after it was called out. Attribution has been important everywhere I've been in my life and I want to be sure the parties involved are aware of each other.
I fully agree and did not mean to suggest otherwise. I am greatly appreciative of @adamjonas for fixing the issue, referencing the original code, and the attribution as well as @fanquake for getting attention to the pull request. The code, though only 5 characters, took some time and I'm grateful to see it was not in vain. Seriously, when I had to rebase this thing I gave up (scary sneks) so it was exciting to see someone else grab it up. |
|
@mchrostowski I agree that I was in the wrong when I opened the PR and mentioned the previous PR but didn't attribute you as the original author as fanquake pointed out (I was unaware of that tag). All I can say is that it wasn't meant as a slight and I'll be more intentional going forward. |
…eblock 436ad43 Fix issue with conflicted mempool tx in listsinceblock (Adam Jonas) Pull request description: Closes bitcoin#8752 by bringing back abandoned bitcoin#10470. This now checks that returned transactions are not conflicting with any transactions that are filtered out by the given blockhash and add a functional test to prevent this in the future. For more context, bitcoin#8757 was closed in favor of bitcoin#10470. ACKs for top commit: instagibbs: utACK bitcoin@436ad43 kallewoof: utACK 436ad43 jonatack: I'm not qualifed to give an ACK here but 436ad43 appears reasonable. Built/ran tests/verified that this test fails without the change in rpcwallet.cpp: Tree-SHA512: 63d75cd3d3f19fc84dc38899b200c96179b82b24db263cd0116ee5b715265be647157855c2e35912d2fbc49c7b37db9375d6aab0ac672f0f09bece8431de5ea9
|
@laanwj Does the "generate release notes contributors" read the |
|
Also, this should probably be backported to 0.19.1? |
listsinceblock now checks that returned transactions are not conflicting with any transactions that are filtered out by the given blockhash Co-Authored-By: Michael Chrostowski <[email protected]> Github-Pull: bitcoin#17258 Rebased-From: 436ad43
listsinceblock now checks that returned transactions are not conflicting with any transactions that are filtered out by the given blockhash Co-Authored-By: Michael Chrostowski <[email protected]> Github-Pull: bitcoin#17258 Rebased-From: 436ad43
|
Being backported in 17792. |
cd67b1d Use correct C++11 header for std::swap() (Hennadii Stepanov) b8101fb Fix comparison function signature (Hennadii Stepanov) eac4907 Don't allow implementers to think ScriptHash(Witness*()) results in nesting computation (Gregory Sanders) e2c45d8 IsUsedDestination shouldn't use key id as script id for ScriptHash (Gregory Sanders) a5489c9 IsUsedDestination should count any known single-key address (Gregory Sanders) 88729d8 Fix issue with conflicted mempool tx in listsinceblock (Adam Jonas) eafcea7 gui: Fix duplicate wallet showing up (João Barbosa) 7e66d04 Drop signal CClientUIInterface::LoadWallet (Russell Yanofsky) 179d55f zmq: Fix due to invalid argument and multiple notifiers (João Barbosa) Pull request description: Backports - #16963 - #17445 - #17258 - #17621 - #17924 - #17634 ACKs for top commit: laanwj: ACK cd67b1d, checked that I got more or less the same result (including conflict resolution) backporting these commits Tree-SHA512: 645786267cfb10a01a56f7cfd91ddead5f1475df5714595ae480237e04d40c5cfb7460b40532279cacd83e4b775a4ace68a258ec2184b8ad0e997a690a9245e5
No, it doesn't at the moment (probably should…). |
…eblock 436ad43 Fix issue with conflicted mempool tx in listsinceblock (Adam Jonas) Pull request description: Closes bitcoin#8752 by bringing back abandoned bitcoin#10470. This now checks that returned transactions are not conflicting with any transactions that are filtered out by the given blockhash and add a functional test to prevent this in the future. For more context, bitcoin#8757 was closed in favor of bitcoin#10470. ACKs for top commit: instagibbs: utACK bitcoin@436ad43 kallewoof: utACK 436ad43 jonatack: I'm not qualifed to give an ACK here but 436ad43 appears reasonable. Built/ran tests/verified that this test fails without the change in rpcwallet.cpp: Tree-SHA512: 63d75cd3d3f19fc84dc38899b200c96179b82b24db263cd0116ee5b715265be647157855c2e35912d2fbc49c7b37db9375d6aab0ac672f0f09bece8431de5ea9
Closes #8752 by bringing back abandoned #10470 originally written by @mchrostowski.
This now checks that returned transactions are not conflicting with any transactions that are filtered out by the given blockhash and add a functional test to prevent this in the future.
For more context, #8757 was closed in favor of #10470.