Skip to content

Conversation

@adamjonas
Copy link
Member

@adamjonas adamjonas commented Oct 25, 2019

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.

@fanquake
Copy link
Member

Was the intention to cherry-pick / attribute the original author here? You could add a Co-Authored-By: Author Name <[email protected]> to the commit body.

@adamjonas adamjonas force-pushed the listsinceblock-filter-conflicts branch from 1d3f144 to 700a288 Compare October 25, 2019 19:58
@adamjonas
Copy link
Member Author

Thanks @fanquake. It was extra work to rebase original commits since listsinceblock.py was merged into wallet_listsinceblock.py. Updated to reflect the contribution of the original author.

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 25, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #15931 (Remove GetDepthInMainChain dependency on locked chain interface by ariard)

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.

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.

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?

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 6?

Copy link
Member Author

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]>
@adamjonas adamjonas force-pushed the listsinceblock-filter-conflicts branch from 676991e to 436ad43 Compare October 28, 2019 14:27
@instagibbs
Copy link
Member

utACK 436ad43

but someone with more history with the RPC call should review

@fanquake fanquake requested a review from kallewoof October 29, 2019 12:50
@kallewoof
Copy link
Contributor

utACK 436ad43

Copy link
Member

@jonatack jonatack left a 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) {
Copy link
Member

@jonatack jonatack Nov 4, 2019

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
Copy link
Member

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

@meshcollider
Copy link
Contributor

LGTM 436ad43

meshcollider added a commit that referenced this pull request Nov 5, 2019
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
@meshcollider meshcollider merged commit 436ad43 into bitcoin:master Nov 5, 2019
@mchrostowski
Copy link
Contributor

mchrostowski commented Nov 5, 2019

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!

@adamjonas adamjonas deleted the listsinceblock-filter-conflicts branch November 5, 2019 21:24
@kallewoof
Copy link
Contributor

kallewoof commented Nov 6, 2019

I'm still confused as to why you put your name on my work.

Good job getting the fix in.

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.

@laanwj
Copy link
Member

laanwj commented Nov 6, 2019

I'm still confused as to why you put your name on my work.

I don't think that complaint is warranted. Looking at the commit it's attributed in every way possible.

Fix issue with conflicted mempool tx in listsinceblock
@adamjonas
@mchrostowski
adamjonas and mchrostowski committed 16 days ago

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]>

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.

@ryanofsky
Copy link
Contributor

I don't think that complaint is warranted. Looking at the commit it's attributed in every way possible.

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 [...]"

@mchrostowski
Copy link
Contributor

mchrostowski commented Nov 6, 2019

Looking at the commit it's attributed in every way possible.

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.

It's also bad etiquette to change a commit and not add your own name, because it's no longer the original work.

I fully agree and did not mean to suggest otherwise.
It actually looks like it was a lot more changes than I anticipated so I see why he nuked my commits and made one so I should not have made the comment.

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.

@adamjonas
Copy link
Member Author

adamjonas commented Nov 6, 2019

@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.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Nov 7, 2019
…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
@maflcko
Copy link
Member

maflcko commented Nov 11, 2019

@laanwj Does the "generate release notes contributors" read the Co-Authored-By: tag from commit bodies as well?

@maflcko
Copy link
Member

maflcko commented Nov 11, 2019

Also, this should probably be backported to 0.19.1?

luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Nov 15, 2019
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
MarkLTZ added a commit to litecoinz-core/litecoinz that referenced this pull request Nov 17, 2019
@fanquake fanquake mentioned this pull request Jan 14, 2020
promag pushed a commit to promag/bitcoin that referenced this pull request Jan 14, 2020
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
@fanquake
Copy link
Member

Being backported in 17792.

laanwj added a commit that referenced this pull request Jan 20, 2020
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
@laanwj
Copy link
Member

laanwj commented Jan 23, 2020

@laanwj Does the "generate release notes contributors" read the Co-Authored-By: tag from commit bodies as well?

No, it doesn't at the moment (probably should…).

sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
…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
@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.

rpc listsinceblock hash is not correctly filtering double-spends