Skip to content

Conversation

@jnewbery
Copy link
Contributor

@jnewbery jnewbery commented Feb 10, 2017

We can call gettxoutproof() with a list of transactions. Currently, if
the first transaction is unspent (and all other transactions are in the
same block), then the call will succeed. If the first transaction has
been spent, then the call will fail. The means that the following two
calls will return different results:

  • gettxoutproof(unspent_tx1, spent_tx1)
  • gettxoutproof(spent_tx1, unspent_tx1)

This commit makes behaviour independent of transaction ordering by looping
through all transactions provided and trying to find which block they're in.

This commit also increases the test coverage and tests more failure
cases for gettxoutproof()

Note to reviewers: builds on #9707 - please review only the second commit in this PR.

Copy link
Member

Choose a reason for hiding this comment

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

seems like this is the last txid, not the first in the list? Little confused on current behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ha. Yes, you're right. This is the last transaction in the list.

%s/first/last/g my original comment

Copy link
Member

Choose a reason for hiding this comment

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

how about "Not all transactions found in the retrieved block" since this can happen when it is unspecified as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed it to "Not all transactions found in the specified or retrieved block"

@TheBlueMatt
Copy link
Contributor

utACK 5dca91d5cf8dfc99343c6e18a223504049a7f68b (assuming the test is fixed - it looks like it was just the string was changed in code but the RPC test's check for string didnt get updated - yay for tests testing things 👍 )

@jnewbery
Copy link
Contributor Author

ok, should be fixed. #9707 has now been merged so this PR nwo contains only the relevant commit.

@jnewbery
Copy link
Contributor Author

rebased

@laanwj
Copy link
Member

laanwj commented Jun 6, 2017

Needs rebase

@jnewbery jnewbery force-pushed the fixgettxoutproof branch 2 times, most recently from 0a6ab2e to ae69c38 Compare June 6, 2017 15:47
@jnewbery
Copy link
Contributor Author

jnewbery commented Jun 6, 2017

rebased

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the nHeight checks are a mistranslation to per-utxo, so should just be dropped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Fixed

We can call gettxoutproof() with a list of transactions. Currently, if
the first transaction is unspent (and all other transactions are in the
same block), then the call will succeed. If the first transaction has
been spent, then the call will fail. The means that the following two
calls will return different results:

gettxoutproof(unspent_tx1, spent_tx1)
gettxoutproof(spent_tx1, unspent_tx1)

This commit makes behaviour independent of transaction ordering by looping
through all transactions provided and trying to find which block they're in.

This commit also increases the test coverage and tests more failure
cases for gettxoutproof()
@jnewbery jnewbery force-pushed the fixgettxoutproof branch from ae69c38 to 6294f32 Compare June 7, 2017 21:39
@laanwj
Copy link
Member

laanwj commented Jun 14, 2017

utACK 6294f32

@laanwj laanwj merged commit 6294f32 into bitcoin:master Jun 14, 2017
laanwj added a commit that referenced this pull request Jun 14, 2017
6294f32 gettxoutproof() should return consistent result (John Newbery)

Tree-SHA512: 1c36f78ea07a3bdde09e9494207b4372d54bcd94ed2d56e339e78281f6693e26a93e4c3123453d5c0f6e994d0069d5a1c806786c4af71864f87ea4841611c379
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 9, 2019
6294f32 gettxoutproof() should return consistent result (John Newbery)

Tree-SHA512: 1c36f78ea07a3bdde09e9494207b4372d54bcd94ed2d56e339e78281f6693e26a93e4c3123453d5c0f6e994d0069d5a1c806786c4af71864f87ea4841611c379
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
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.

5 participants