Page MenuHomePhabricator

Merge #13142: Separate IsMine from solvability
ClosedPublic

Authored by markblundeberg on Jan 12 2020, 12:55.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Branch
pr13142
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 8885
Build 15745: Default Diff Build & Tests
Build 15744: arc lint + arc unit

Event Timeline

deadalnix requested changes to this revision.Jan 12 2020, 14:35
deadalnix added inline comments.
src/script/ismine.cpp
92 ↗(On Diff #15361)

They actually added braces here in that patch, but you should do so in the first patch.

This revision now requires changes to proceed.Jan 12 2020, 14:35
src/script/ismine.cpp
92 ↗(On Diff #15361)

yep

This revision is now accepted and ready to land.Jan 13 2020, 14:40