If a witness signature was created when a non-witness UTXO is used, convert the non-witness UTXO to a witness one.
Port of #14196 to master.
275@@ -276,6 +276,13 @@ bool SignPSBTInput(const SigningProvider& provider, const CMutableTransaction& t
276 // Verify that a witness signature was produced in case one was required.
277 if (require_witness_sig && !sigdata.witness) return false;
278 input.FromSignatureData(sigdata);
279+
276@@ -277,6 +277,13 @@ bool SignPSBTInput(const SigningProvider& provider, const CMutableTransaction& t
277 if (require_witness_sig && !sigdata.witness) return false;
278 input.FromSignatureData(sigdata);
279
280+ if (sigdata.witness) {
281+ // Convert the non-witness utxo to witness
282+ if (input.witness_utxo.IsNull() && input.non_witness_utxo) {
283+ input.witness_utxo = input.non_witness_utxo->vout[tx.vin[index].prevout.n];
IIUC this could be
0assert(!utxo.IsNull());
1input.witness_utxo = utxo;
If a witness signature was created when a non-witness UTXO is used,
convert the non-witness UTXO to a witness one.
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
5@@ -6,7 +6,7 @@
6 """
7
8 from test_framework.test_framework import BitcoinTestFramework
9-from test_framework.util import assert_equal, assert_raises_rpc_error, find_output
10+from test_framework.util import assert_equal, assert_raises_rpc_error, find_output, disconnect_nodes, connect_nodes_bi, sync_blocks
Coverage | Change (pull 14197) | Reference (master) |
---|---|---|
Lines | +0.0163 % | 87.0361 % |
Functions | +0.1081 % | 84.1130 % |
Branches | -0.0057 % | 51.5451 % |