Page MenuHomePhabricator

gettxoutproof() should return consistent result
ClosedPublic

Authored by deadalnix on Jan 8 2018, 14:24.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Glad you grabbed this. This is one that was on my list for backporting.

This revision is now accepted and ready to land.Jan 9 2018, 17:17
This revision was automatically updated to reflect the committed changes.