From 25df8aa12b656675bc4bcf01a6b3900a0b222667 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Fri, 16 Apr 2021 16:04:14 -0400 Subject: [PATCH] Fixes to FillPSBT --- src/wallet/rpcwallet.cpp | 4 ++-- src/wallet/scriptpubkeyman.cpp | 1 - src/wallet/wallet.cpp | 11 +++-------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index ebf5679b20..ed0497e9a2 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4799,7 +4799,7 @@ static RPCHelpMan walletprocesspsbt() // Don't sign, just fill data. bool bip32derivs = request.params[3].isNull() ? true : request.params[3].get_bool(); bool complete = true; - const TransactionError err = pwallet->FillPSBT(psbtx, complete, nHashType, false, bip32derivs); + const TransactionError err = pwallet->FillPSBT(psbtx, complete, nHashType, false, bip32derivs, true); if (err != TransactionError::OK) { throw JSONRPCTransactionError(err); } @@ -5119,7 +5119,7 @@ static RPCHelpMan walletcreatefundedpsbt() // Fill transaction with out data but don't sign bool bip32derivs = request.params[4].isNull() ? false : request.params[4].get_bool(); bool complete = true; - const TransactionError err = pwallet->FillPSBT(psbtx, complete, 1, false, bip32derivs); + const TransactionError err = pwallet->FillPSBT(psbtx, complete, 1, false, bip32derivs, true); if (err != TransactionError::OK) { throw JSONRPCTransactionError(err); } diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index 099ab12ee3..b33e3d5179 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -2090,7 +2090,6 @@ TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction& *n_signed = 0; } for (unsigned int i = 0; i < psbtx.inputs.size(); ++i) { - const CTxIn& txin = psbtx.tx->vin[i]; PSBTInput& input = psbtx.inputs.at(i); if (PSBTInputSigned(input)) { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 4905d1b488..70d658e323 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2733,15 +2733,10 @@ TransactionError CWallet::FillPSBTData(PartiallySignedTransaction& psbtx, bool b // We only need the non_witness_utxo, which is a superset of the witness_utxo. // The signing code will switch to the smaller witness_utxo if this is ok. input.non_witness_utxo = wtx.tx; - -/* - // ELEMENTS: Grab the CA data - CAmount val_tmp; - wtx.GetNonIssuanceBlindingData(txin.prevout.n, nullptr, &val_tmp, &input.value_blinding_factor, &input.asset, &input.asset_blinding_factor); - if (val_tmp != -1) { - input.value = val_tmp; + // Set the UTXO rangeproof separately, if it's there + if (*input.prev_out < wtx.tx->witness.vtxoutwit.size() && !wtx.tx->witness.vtxoutwit[*input.prev_out].vchRangeproof.empty()) { + input.m_utxo_rangeproof = wtx.tx->witness.vtxoutwit[*input.prev_out].vchRangeproof; } -*/ } } }