Page MenuHomePhabricator

Refactor PSBT signing logic to enforce invariant
ClosedPublic

Authored by Fabien on Apr 13 2020, 19:03.

Details

Summary

Backport of core PR14588.

This refactor repairs the invariant, [...]. It also simplifies some
other code, and removes redundant parameters from some related
functions.

Note that the bug fixed in the PR is not affecting us, but I kept the
test as it can't hurt.

Also the IsSane() method is kept for easier backports, despite it does
nothing and will be optimized out by the compiler.

Test Plan
ninja check check-functional

Diff Detail

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

Event Timeline

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

deadalnix requested changes to this revision.Apr 13 2020, 22:42
deadalnix added a subscriber: deadalnix.
deadalnix added inline comments.
src/wallet/rpcwallet.cpp
4893 ↗(On Diff #18774)

Why did you change the name? There is only downsides afaik. Please revert to rawTx.

This revision now requires changes to proceed.Apr 13 2020, 22:42
Fabien planned changes to this revision.Apr 14 2020, 08:50
Fabien added inline comments.
src/wallet/rpcwallet.cpp
4893 ↗(On Diff #18774)

Since I need to convert the CMutableTransaction to a CTransaction (core does implicit conversion) I thought mtx vs tx was better than rawTx vs tx. Not a strong opinion though, so I will revert to avoid confusion.

deadalnix added inline comments.
src/wallet/rpcwallet.cpp
4899 ↗(On Diff #18793)

Why create a temporary? You can simply do

PartiallySignedTransaction psbtx(CTransaction(rawTx));
This revision is now accepted and ready to land.Apr 14 2020, 13:40
src/wallet/rpcwallet.cpp
4899 ↗(On Diff #18793)

That won't build, at least with clang 9.