From 3b6131c84ae8f9d3a9a71170130e8baef25293bb Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Thu, 4 Jun 2020 20:06:19 -0400 Subject: [PATCH] test: Patch bitcoind to give out PSBTs with both UTXOs --- test/data/psbt_non_witness_utxo_segwit.patch | 431 +++++++++++++++++++ test/setup_environment.sh | 1 + 2 files changed, 432 insertions(+) create mode 100644 test/data/psbt_non_witness_utxo_segwit.patch diff --git a/test/data/psbt_non_witness_utxo_segwit.patch b/test/data/psbt_non_witness_utxo_segwit.patch new file mode 100644 index 000000000..49b1f7967 --- /dev/null +++ b/test/data/psbt_non_witness_utxo_segwit.patch @@ -0,0 +1,431 @@ +From 30477b10795dc3e819cc852823f2e00e4e23f770 Mon Sep 17 00:00:00 2001 +From: Andrew Chow +Date: Thu, 4 Jun 2020 23:43:25 -0400 +Subject: [PATCH 1/3] rpc: show both UTXOs in decodepsbt + +--- + src/rpc/rawtransaction.cpp | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp +index e14217c307..45cf6be3a0 100644 +--- a/src/rpc/rawtransaction.cpp ++++ b/src/rpc/rawtransaction.cpp +@@ -1104,6 +1104,7 @@ UniValue decodepsbt(const JSONRPCRequest& request) + const PSBTInput& input = psbtx.inputs[i]; + UniValue in(UniValue::VOBJ); + // UTXOs ++ bool have_a_utxo = false; + if (!input.witness_utxo.IsNull()) { + const CTxOut& txout = input.witness_utxo; + +@@ -1121,7 +1122,9 @@ UniValue decodepsbt(const JSONRPCRequest& request) + ScriptToUniv(txout.scriptPubKey, o, true); + out.pushKV("scriptPubKey", o); + in.pushKV("witness_utxo", out); +- } else if (input.non_witness_utxo) { ++ have_a_utxo = true; ++ } ++ if (input.non_witness_utxo) { + UniValue non_wit(UniValue::VOBJ); + TxToUniv(*input.non_witness_utxo, uint256(), non_wit, false); + in.pushKV("non_witness_utxo", non_wit); +@@ -1132,7 +1135,9 @@ UniValue decodepsbt(const JSONRPCRequest& request) + // Hack to just not show fee later + have_all_utxos = false; + } +- } else { ++ have_a_utxo = true; ++ } ++ if (!have_a_utxo) { + have_all_utxos = false; + } + +-- +2.27.0 + + +From fcf1ef6529a010d05a79f9ba6dbfbc480de99af5 Mon Sep 17 00:00:00 2001 +From: Andrew Chow +Date: Thu, 4 Jun 2020 23:43:39 -0400 +Subject: [PATCH 2/3] psbt: Allow both non_witness_utxo and witness_utxo + +--- + src/psbt.cpp | 29 ----------------------------- + src/psbt.h | 7 ------- + src/test/fuzz/psbt.cpp | 2 -- + src/wallet/scriptpubkeyman.cpp | 10 ---------- + src/wallet/wallet.cpp | 5 ----- + 5 files changed, 53 deletions(-) + +diff --git a/src/psbt.cpp b/src/psbt.cpp +index ef9781817a..4c8b40ca0b 100644 +--- a/src/psbt.cpp ++++ b/src/psbt.cpp +@@ -35,14 +35,6 @@ bool PartiallySignedTransaction::Merge(const PartiallySignedTransaction& psbt) + return true; + } + +-bool PartiallySignedTransaction::IsSane() const +-{ +- for (PSBTInput input : inputs) { +- if (!input.IsSane()) return false; +- } +- return true; +-} +- + bool PartiallySignedTransaction::AddInput(const CTxIn& txin, PSBTInput& psbtin) + { + if (std::find(tx->vin.begin(), tx->vin.end(), txin) != tx->vin.end()) { +@@ -158,18 +150,6 @@ void PSBTInput::Merge(const PSBTInput& input) + if (final_script_witness.IsNull() && !input.final_script_witness.IsNull()) final_script_witness = input.final_script_witness; + } + +-bool PSBTInput::IsSane() const +-{ +- // Cannot have both witness and non-witness utxos +- if (!witness_utxo.IsNull() && non_witness_utxo) return false; +- +- // If we have a witness_script or a scriptWitness, we must also have a witness utxo +- if (!witness_script.empty() && witness_utxo.IsNull()) return false; +- if (!final_script_witness.IsNull() && witness_utxo.IsNull()) return false; +- +- return true; +-} +- + void PSBTOutput::FillSignatureData(SignatureData& sigdata) const + { + if (!redeem_script.empty()) { +@@ -250,11 +230,6 @@ bool SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction& + bool require_witness_sig = false; + CTxOut utxo; + +- // Verify input sanity, which checks that at most one of witness or non-witness utxos is provided. +- if (!input.IsSane()) { +- return false; +- } +- + if (input.non_witness_utxo) { + // If we're taking our information from a non-witness UTXO, verify that it matches the prevout. + COutPoint prevout = tx.vin[index].prevout; +@@ -345,10 +320,6 @@ TransactionError CombinePSBTs(PartiallySignedTransaction& out, const std::vector + return TransactionError::PSBT_MISMATCH; + } + } +- if (!out.IsSane()) { +- return TransactionError::INVALID_PSBT; +- } +- + return TransactionError::OK; + } + +diff --git a/src/psbt.h b/src/psbt.h +index 888e0fd119..cbf4296bd2 100644 +--- a/src/psbt.h ++++ b/src/psbt.h +@@ -62,7 +62,6 @@ struct PSBTInput + void FillSignatureData(SignatureData& sigdata) const; + void FromSignatureData(const SignatureData& sigdata); + void Merge(const PSBTInput& input); +- bool IsSane() const; + PSBTInput() {} + + template +@@ -284,7 +283,6 @@ struct PSBTOutput + void FillSignatureData(SignatureData& sigdata) const; + void FromSignatureData(const SignatureData& sigdata); + void Merge(const PSBTOutput& output); +- bool IsSane() const; + PSBTOutput() {} + + template +@@ -401,7 +399,6 @@ struct PartiallySignedTransaction + /** Merge psbt into this. The two psbts must have the same underlying CTransaction (i.e. the + * same actual Bitcoin transaction.) Returns true if the merge succeeded, false otherwise. */ + NODISCARD bool Merge(const PartiallySignedTransaction& psbt); +- bool IsSane() const; + bool AddInput(const CTxIn& txin, PSBTInput& psbtin); + bool AddOutput(const CTxOut& txout, const PSBTOutput& psbtout); + PartiallySignedTransaction() {} +@@ -551,10 +548,6 @@ struct PartiallySignedTransaction + if (outputs.size() != tx->vout.size()) { + throw std::ios_base::failure("Outputs provided does not match the number of outputs in transaction."); + } +- // Sanity check +- if (!IsSane()) { +- throw std::ios_base::failure("PSBT is not sane."); +- } + } + + template +diff --git a/src/test/fuzz/psbt.cpp b/src/test/fuzz/psbt.cpp +index 64328fb66e..908e2b16f2 100644 +--- a/src/test/fuzz/psbt.cpp ++++ b/src/test/fuzz/psbt.cpp +@@ -39,7 +39,6 @@ void test_one_input(const std::vector& buffer) + } + + (void)psbt.IsNull(); +- (void)psbt.IsSane(); + + Optional tx = psbt.tx; + if (tx) { +@@ -50,7 +49,6 @@ void test_one_input(const std::vector& buffer) + for (const PSBTInput& input : psbt.inputs) { + (void)PSBTInputSigned(input); + (void)input.IsNull(); +- (void)input.IsSane(); + } + + for (const PSBTOutput& output : psbt.outputs) { +diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp +index 8a2a798644..9fae27975d 100644 +--- a/src/wallet/scriptpubkeyman.cpp ++++ b/src/wallet/scriptpubkeyman.cpp +@@ -595,11 +595,6 @@ TransactionError LegacyScriptPubKeyMan::FillPSBT(PartiallySignedTransaction& psb + continue; + } + +- // Verify input looks sane. This will check that we have at most one uxto, witness or non-witness. +- if (!input.IsSane()) { +- return TransactionError::INVALID_PSBT; +- } +- + // Get the Sighash type + if (sign && input.sighash_type > 0 && input.sighash_type != sighash_type) { + return TransactionError::SIGHASH_MISMATCH; +@@ -2074,11 +2069,6 @@ TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction& + continue; + } + +- // Verify input looks sane. This will check that we have at most one uxto, witness or non-witness. +- if (!input.IsSane()) { +- return TransactionError::INVALID_PSBT; +- } +- + // Get the Sighash type + if (sign && input.sighash_type > 0 && input.sighash_type != sighash_type) { + return TransactionError::SIGHASH_MISMATCH; +diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp +index 89737ca7b5..054b312cd7 100644 +--- a/src/wallet/wallet.cpp ++++ b/src/wallet/wallet.cpp +@@ -2490,11 +2490,6 @@ TransactionError CWallet::FillPSBT(PartiallySignedTransaction& psbtx, bool& comp + continue; + } + +- // Verify input looks sane. This will check that we have at most one uxto, witness or non-witness. +- if (!input.IsSane()) { +- return TransactionError::INVALID_PSBT; +- } +- + // If we have no utxo, grab it from the wallet. + if (!input.non_witness_utxo && input.witness_utxo.IsNull()) { + const uint256& txhash = txin.prevout.hash; +-- +2.27.0 + + +From 946b5c010fa23103c1ee5f584bd5be240e42c4c9 Mon Sep 17 00:00:00 2001 +From: Andrew Chow +Date: Thu, 4 Jun 2020 23:43:43 -0400 +Subject: [PATCH 3/3] 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. +--- + src/psbt.cpp | 7 +- + src/psbt.h | 4 +- + src/wallet/test/psbt_wallet_tests.cpp | 2 +- + src/wallet/wallet.cpp | 2 +- + test/functional/rpc_psbt.py | 94 ++++++++++++++------------- + 5 files changed, 56 insertions(+), 53 deletions(-) + +diff --git a/src/psbt.cpp b/src/psbt.cpp +index 4c8b40ca0b..51f829d533 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 +diff --git a/src/psbt.h b/src/psbt.h +index cbf4296bd2..275fb03cd8 100644 +--- a/src/psbt.h ++++ b/src/psbt.h +@@ -67,12 +67,12 @@ struct PSBTInput + template + inline void Serialize(Stream& s) const { + // Write the utxo +- // If there is a non-witness utxo, then don't add the witness one. + if (non_witness_utxo) { + SerializeToVector(s, PSBT_IN_NON_WITNESS_UTXO); + OverrideStream os(&s, s.GetType(), s.GetVersion() | SERIALIZE_TRANSACTION_NO_WITNESS); + SerializeToVector(os, non_witness_utxo); +- } else if (!witness_utxo.IsNull()) { ++ } ++ if (!witness_utxo.IsNull()) { + SerializeToVector(s, PSBT_IN_WITNESS_UTXO); + SerializeToVector(s, witness_utxo); + } +diff --git a/src/wallet/test/psbt_wallet_tests.cpp b/src/wallet/test/psbt_wallet_tests.cpp +index b4c65a8665..119457aadf 100644 +--- a/src/wallet/test/psbt_wallet_tests.cpp ++++ b/src/wallet/test/psbt_wallet_tests.cpp +@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(psbt_updater_test) + CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); + ssTx << psbtx; + std::string final_hex = HexStr(ssTx.begin(), ssTx.end()); +- BOOST_CHECK_EQUAL(final_hex, "70736274ff01009a020000000258e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd750000000000ffffffff838d0427d0ec650a68aa46bb0b098aea4422c071b2ca78352a077959d07cea1d0100000000ffffffff0270aaf00800000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00e1f5050000000016001400aea9a2e5f0f876a588df5546e8742d1d87008f00000000000100bb0200000001aad73931018bd25f84ae400b68848be09db706eac2ac18298babee71ab656f8b0000000048473044022058f6fc7c6a33e1b31548d481c826c015bd30135aad42cd67790dab66d2ad243b02204a1ced2604c6735b6393e5b41691dd78b00f0c5942fb9f751856faa938157dba01feffffff0280f0fa020000000017a9140fb9463421696b82c833af241c78c17ddbde493487d0f20a270100000017a91429ca74f8a08f81999428185c97b5d852e4063f6187650000000104475221029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f2102dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d752ae2206029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f10d90c6a4f000000800000008000000080220602dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d710d90c6a4f0000008000000080010000800001012000c2eb0b0000000017a914b7f5faf40e3d40a5a459b1db3535f2b72fa921e88701042200208c2353173743b595dfb4a07b72ba8e42e3797da74e87fe7d9d7497e3b2028903010547522103089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc21023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e7352ae2206023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e7310d90c6a4f000000800000008003000080220603089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc10d90c6a4f00000080000000800200008000220203a9a4c37f5996d3aa25dbac6b570af0650394492942460b354753ed9eeca5877110d90c6a4f000000800000008004000080002202027f6399757d2eff55a136ad02c684b1838b6556e5f1b6b34282a94b6b5005109610d90c6a4f00000080000000800500008000"); ++ BOOST_CHECK_EQUAL(final_hex, "70736274ff01009a020000000258e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd750000000000ffffffff838d0427d0ec650a68aa46bb0b098aea4422c071b2ca78352a077959d07cea1d0100000000ffffffff0270aaf00800000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00e1f5050000000016001400aea9a2e5f0f876a588df5546e8742d1d87008f00000000000100bb0200000001aad73931018bd25f84ae400b68848be09db706eac2ac18298babee71ab656f8b0000000048473044022058f6fc7c6a33e1b31548d481c826c015bd30135aad42cd67790dab66d2ad243b02204a1ced2604c6735b6393e5b41691dd78b00f0c5942fb9f751856faa938157dba01feffffff0280f0fa020000000017a9140fb9463421696b82c833af241c78c17ddbde493487d0f20a270100000017a91429ca74f8a08f81999428185c97b5d852e4063f6187650000000104475221029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f2102dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d752ae2206029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f10d90c6a4f000000800000008000000080220602dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d710d90c6a4f0000008000000080010000800001008a020000000158e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd7501000000171600145f275f436b09a8cc9a2eb2a2f528485c68a56323feffffff02d8231f1b0100000017a914aed962d6654f9a2b36608eb9d64d2b260db4f1118700c2eb0b0000000017a914b7f5faf40e3d40a5a459b1db3535f2b72fa921e8876500000001012000c2eb0b0000000017a914b7f5faf40e3d40a5a459b1db3535f2b72fa921e88701042200208c2353173743b595dfb4a07b72ba8e42e3797da74e87fe7d9d7497e3b2028903010547522103089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc21023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e7352ae2206023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e7310d90c6a4f000000800000008003000080220603089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc10d90c6a4f00000080000000800200008000220203a9a4c37f5996d3aa25dbac6b570af0650394492942460b354753ed9eeca5877110d90c6a4f000000800000008004000080002202027f6399757d2eff55a136ad02c684b1838b6556e5f1b6b34282a94b6b5005109610d90c6a4f00000080000000800500008000"); + + // Mutate the transaction so that one of the inputs is invalid + psbtx.tx->vin[0].prevout.n = 2; +diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp +index 054b312cd7..7816a39ec1 100644 +--- a/src/wallet/wallet.cpp ++++ b/src/wallet/wallet.cpp +@@ -2491,7 +2491,7 @@ TransactionError CWallet::FillPSBT(PartiallySignedTransaction& psbtx, bool& comp + } + + // If we have no utxo, grab it from the wallet. +- if (!input.non_witness_utxo && input.witness_utxo.IsNull()) { ++ if (!input.non_witness_utxo) { + const uint256& txhash = txin.prevout.hash; + const auto it = mapWallet.find(txhash); + if (it != mapWallet.end()) { +diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py +index 51d136d26a..735293bbc7 100755 +--- a/test/functional/rpc_psbt.py ++++ b/test/functional/rpc_psbt.py +@@ -37,51 +37,52 @@ class PSBTTest(BitcoinTestFramework): + def skip_test_if_missing_module(self): + self.skip_if_no_wallet() + +- def test_utxo_conversion(self): +- mining_node = self.nodes[2] +- offline_node = self.nodes[0] +- online_node = self.nodes[1] +- +- # Disconnect offline node from others +- disconnect_nodes(offline_node, 1) +- disconnect_nodes(online_node, 0) +- disconnect_nodes(offline_node, 2) +- disconnect_nodes(mining_node, 0) +- +- # Create watchonly on online_node +- online_node.createwallet(wallet_name='wonline', disable_private_keys=True) +- wonline = online_node.get_wallet_rpc('wonline') +- w2 = online_node.get_wallet_rpc('') +- +- # Mine a transaction that credits the offline address +- offline_addr = offline_node.getnewaddress(address_type="p2sh-segwit") +- online_addr = w2.getnewaddress(address_type="p2sh-segwit") +- wonline.importaddress(offline_addr, "", False) +- mining_node.sendtoaddress(address=offline_addr, amount=1.0) +- mining_node.generate(nblocks=1) +- self.sync_blocks([mining_node, online_node]) +- +- # Construct an unsigned PSBT on the online node (who doesn't know the output is Segwit, so will include a non-witness UTXO) +- utxos = wonline.listunspent(addresses=[offline_addr]) +- raw = wonline.createrawtransaction([{"txid":utxos[0]["txid"], "vout":utxos[0]["vout"]}],[{online_addr:0.9999}]) +- psbt = wonline.walletprocesspsbt(online_node.converttopsbt(raw))["psbt"] +- assert "non_witness_utxo" in mining_node.decodepsbt(psbt)["inputs"][0] +- +- # Have the offline node sign the PSBT (which will update the UTXO to segwit) +- signed_psbt = offline_node.walletprocesspsbt(psbt)["psbt"] +- assert "witness_utxo" in mining_node.decodepsbt(signed_psbt)["inputs"][0] +- +- # Make sure we can mine the resulting transaction +- txid = mining_node.sendrawtransaction(mining_node.finalizepsbt(signed_psbt)["hex"]) +- mining_node.generate(1) +- self.sync_blocks([mining_node, online_node]) +- assert_equal(online_node.gettxout(txid,0)["confirmations"], 1) +- +- wonline.unloadwallet() +- +- # Reconnect +- connect_nodes(self.nodes[0], 1) +- connect_nodes(self.nodes[0], 2) ++ # TODO: Re-enable this test with segwit v1 ++ # def test_utxo_conversion(self): ++ # mining_node = self.nodes[2] ++ # offline_node = self.nodes[0] ++ # online_node = self.nodes[1] ++ # ++ # # Disconnect offline node from others ++ # disconnect_nodes(offline_node, 1) ++ # disconnect_nodes(online_node, 0) ++ # disconnect_nodes(offline_node, 2) ++ # disconnect_nodes(mining_node, 0) ++ # ++ # # Create watchonly on online_node ++ # online_node.createwallet(wallet_name='wonline', disable_private_keys=True) ++ # wonline = online_node.get_wallet_rpc('wonline') ++ # w2 = online_node.get_wallet_rpc('') ++ # ++ # # Mine a transaction that credits the offline address ++ # offline_addr = offline_node.getnewaddress(address_type="p2sh-segwit") ++ # online_addr = w2.getnewaddress(address_type="p2sh-segwit") ++ # wonline.importaddress(offline_addr, "", False) ++ # mining_node.sendtoaddress(address=offline_addr, amount=1.0) ++ # mining_node.generate(nblocks=1) ++ # self.sync_blocks([mining_node, online_node]) ++ # ++ # # Construct an unsigned PSBT on the online node (who doesn't know the output is Segwit, so will include a non-witness UTXO) ++ # utxos = wonline.listunspent(addresses=[offline_addr]) ++ # raw = wonline.createrawtransaction([{"txid":utxos[0]["txid"], "vout":utxos[0]["vout"]}],[{online_addr:0.9999}]) ++ # psbt = wonline.walletprocesspsbt(online_node.converttopsbt(raw))["psbt"] ++ # assert "non_witness_utxo" in mining_node.decodepsbt(psbt)["inputs"][0] ++ # ++ # # Have the offline node sign the PSBT (which will update the UTXO to segwit) ++ # signed_psbt = offline_node.walletprocesspsbt(psbt)["psbt"] ++ # assert "witness_utxo" in mining_node.decodepsbt(signed_psbt)["inputs"][0] ++ # ++ # # Make sure we can mine the resulting transaction ++ # txid = mining_node.sendrawtransaction(mining_node.finalizepsbt(signed_psbt)["hex"]) ++ # mining_node.generate(1) ++ # self.sync_blocks([mining_node, online_node]) ++ # assert_equal(online_node.gettxout(txid,0)["confirmations"], 1) ++ # ++ # wonline.unloadwallet() ++ # ++ # # Reconnect ++ # connect_nodes(self.nodes[0], 1) ++ # connect_nodes(self.nodes[0], 2) + + def run_test(self): + # Create and fund a raw tx for sending 10 BTC +@@ -346,7 +347,8 @@ class PSBTTest(BitcoinTestFramework): + for i, signer in enumerate(signers): + self.nodes[2].unloadwallet("wallet{}".format(i)) + +- self.test_utxo_conversion() ++ # TODO: Re-enable this for segwit v1 ++ # self.test_utxo_conversion() + + # Test that psbts with p2pkh outputs are created properly + p2pkh = self.nodes[0].getnewaddress(address_type='legacy') +-- +2.27.0 + diff --git a/test/setup_environment.sh b/test/setup_environment.sh index acb9af26f..6bf0c525a 100755 --- a/test/setup_environment.sh +++ b/test/setup_environment.sh @@ -216,6 +216,7 @@ else bitcoind_setup_needed=true fi fi +git am ../../data/psbt_non_witness_utxo_segwit.patch # Build bitcoind. This is super slow, but it is cached so it runs fairly quickly. if [ "$bitcoind_setup_needed" == true ] ; then