HomePhabricator

gettxoutproof() should return consistent result

Description

gettxoutproof() should return consistent result

Summary:
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()

This is backport of core's PR9738

Test Plan:

make check
./test/functional/test_runner.py merkle_blocks.py

Reviewers: schancel, #bitcoin_abc

Reviewed By: schancel, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D922

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Feb 10 2017, 16:04
deadalnixCommitted on Jan 10 2018, 20:58
deadalnixPushed on Jan 10 2018, 21:00
Reviewer
Restricted Project
Differential Revision
D922: gettxoutproof() should return consistent result
Parents
rSTAGINGab045d0af1fe: Fix RPC failure testing
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/2440