diff options
author | Andrew Chow <achow101-github@achow101.com> | 2020-06-04 23:43:43 -0400 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-07-03 09:21:42 +0800 |
commit | 3228b59b1761a80bca6aa7309cb46db5acafc905 (patch) | |
tree | 8b92f26b142fbc3f9855fb1dfb431b2a230266f9 /src/psbt.cpp | |
parent | ed5ec3080419445c0af7410c0af7a421704841a6 (diff) | |
download | bitcoin-3228b59b1761a80bca6aa7309cb46db5acafc905.tar.xz |
psbt: always put a non_witness_utxo and don't remove it
Offline signers will always need a non_witness_utxo so make sure it is
there.
Github-Pull: #19215
Rebased-From: 46004790588c24174a0bec49b540d158ce163ffd
Diffstat (limited to 'src/psbt.cpp')
-rw-r--r-- | src/psbt.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/psbt.cpp b/src/psbt.cpp index ff17981fd8..bfa9e3c667 100644 --- a/src/psbt.cpp +++ b/src/psbt.cpp @@ -136,8 +136,8 @@ void PSBTInput::Merge(const PSBTInput& input) { if (!non_witness_utxo && input.non_witness_utxo) non_witness_utxo = input.non_witness_utxo; if (witness_utxo.IsNull() && !input.witness_utxo.IsNull()) { + // TODO: For segwit v1, we will want to clear out the non-witness utxo when setting a witness one. For v0 and non-segwit, this is not safe witness_utxo = input.witness_utxo; - non_witness_utxo = nullptr; // Clear out any non-witness utxo when we set a witness one. } partial_sigs.insert(input.partial_sigs.begin(), input.partial_sigs.end()); @@ -263,10 +263,11 @@ bool SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction& if (require_witness_sig && !sigdata.witness) return false; input.FromSignatureData(sigdata); - // If we have a witness signature, use the smaller witness UTXO. + // If we have a witness signature, put a witness UTXO. + // TODO: For segwit v1, we should remove the non_witness_utxo if (sigdata.witness) { input.witness_utxo = utxo; - input.non_witness_utxo = nullptr; + // input.non_witness_utxo = nullptr; } // Fill in the missing info |