From b7e58f9c1d9969a26f002613fe6e6fbf9c1def3d Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Tue, 11 Sep 2018 00:11:00 -0400 Subject: [PATCH] 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. --- src/wallet/rpcwallet.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index cbbac4dca..e313a7743 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3988,6 +3988,13 @@ UniValue sethdseed(const JSONRPCRequest& request) return NullUniValue; } + 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]; + } + } + UniValue walletprocesspsbt(const JSONRPCRequest& request) { std::shared_ptr const wallet = GetWalletForJSONRPCRequest(request);