aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcwallet.cpp
diff options
context:
space:
mode:
authorAndrew Chow <[email protected]>2018-09-11 00:11:00 -0400
committerAndrew Chow <[email protected]>2018-09-11 00:11:00 -0400
commitfcefc6851a624b59bd1bb42d211ce69f85969880 (patch)
treebba1b914079964cb51a1dbbba653202910978917 /src/wallet/rpcwallet.cpp
parentDrop the unnecessary UTXO based on the UTXOs present, not on earlier wallet t... (diff)
downloaddiscoin-fcefc6851a624b59bd1bb42d211ce69f85969880.tar.xz
discoin-fcefc6851a624b59bd1bb42d211ce69f85969880.zip
Convert non-witness UTXOs to witness if witness sig created
If a witness signature was created when a non-witness UTXO is used, convert the non-witness UTXO to a witness one.
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r--src/wallet/rpcwallet.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 96e63dac2..b268e9a87 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -4525,6 +4525,13 @@ bool FillPSBT(const CWallet* pwallet, PartiallySignedTransaction& psbtx, const C
complete &= SignPSBTInput(PublicOnlySigningProvider(pwallet), *psbtx.tx, input, sigdata, i, sighash_type);
}
+ if (sigdata.witness) {
+ // Convert the non-witness utxo to witness
+ if (input.witness_utxo.IsNull() && input.non_witness_utxo) {
+ input.witness_utxo = input.non_witness_utxo->vout[txin.prevout.n];
+ }
+ }
+
// If both UTXO types are present, drop the unnecessary one.
if (input.non_witness_utxo && !input.witness_utxo.IsNull()) {
if (sigdata.witness) {