HomePhabricator

Merge #13142: Separate IsMine from solvability

Description

Merge #13142: Separate IsMine from solvability

Summary:
PR13142 backport https://github.com/bitcoin/bitcoin/pull/13142/files

c004ffc9b42a738043e19e4c812fc7e0566119c5 Make handling of invalid in IsMine more uniform (Pieter Wuille)
a53f0feff8d42b7a40d417f77dc8de682dd88fd9 Add some checks for invalid recursion in IsMine (Pieter Wuille)
b5802a9f5f69815d3290361fd8c96d76a037832f Simplify IsMine logic (Pieter Wuille)
4e91820531889e309dc4335fe0de8229c6426040 Make IsMine stop distinguishing solvable/unsolvable (Pieter Wuille)
6d714c3419b368671bd071a8992950c3dc00e613 Make coincontrol use IsSolvable to determine solvability (Pieter Wuille)

Pull request description:

Our current `IsMine` logic does several things with outputs:
* Determine "spendability" (roughly corresponding to "could we sign for this")
* Determine "watching" (is this an output directly or indirectly a watched script)
* Determine invalidity (is this output definitely not legally spendable, detecting accidental uncompressed pubkeys in witnesses)
* Determine "solvability" (would we be able to sign for this ignoring the fact that we may be missing some private keys).

The last item (solvability) is mostly unrelated and only rarely needed (there is just one instance, inside the wallet's coin control logic). This PR changes that instance to use the separate `IsSolvable` function, and stop `IsMine` from distinguishing between solvable and unsolvable.

As an extra, this also simplifies the `IsMine` logic and adds some extra checks (which wouldn't be hit unless someone adds already invalid scripts to their wallet).

Backport notes:

  • Drops various segwit-related stuff.

Depends on D4911 and D4912

Test Plan: ninja check-all

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on May 29 2018, 12:59
Mark Lundeberg <markblundeberg@users.noreply.github.com>Committed on Jan 13 2020, 15:16
markblundebergPushed on Jan 13 2020, 15:16
Reviewer
Restricted Project
Differential Revision
D4913: Merge #13142: Separate IsMine from solvability
Parents
rABC8dc344a1d63d: move ScriptExecutionMetrics to its own file
Branches
Unknown
Tags
Unknown

Event Timeline