diff options
author | fanquake <fanquake@gmail.com> | 2021-10-08 07:59:18 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-10-08 08:19:16 +0800 |
commit | 99e53967c85c20a166803f94ebb127f1d7ee9198 (patch) | |
tree | 8ff2791a3e4dc67a9426df7ab33f935778fa4a5a /src | |
parent | 991753e4d50ea5c973f4d3330e5afba797b1b1e7 (diff) | |
parent | 43568782c23185a0599a6e60d61db4716da1cda1 (diff) | |
download | bitcoin-99e53967c85c20a166803f94ebb127f1d7ee9198.tar.xz |
Merge bitcoin/bitcoin#23188: wallet: fund transaction external input cleanups
43568782c23185a0599a6e60d61db4716da1cda1 External input fund support cleanups (Gregory Sanders)
Pull request description:
Minor cleanups to https://github.com/bitcoin/bitcoin/pull/17211
ACKs for top commit:
achow101:
ACK 43568782c23185a0599a6e60d61db4716da1cda1
meshcollider:
utACK 43568782c23185a0599a6e60d61db4716da1cda1
benthecarman:
ACK 43568782c23185a0599a6e60d61db4716da1cda1
Tree-SHA512: 865f8a3804f8c0027f5393a0539041158166a919378f2c3bc99b936843eee2329372bcc2af888fa62babfa5f6baf4f13d4cfef7b4e26a7265a82a908f9719ad6
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/coincontrol.h | 2 | ||||
-rw-r--r-- | src/wallet/rpcwallet.cpp | 6 | ||||
-rw-r--r-- | src/wallet/spend.cpp | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/wallet/coincontrol.h b/src/wallet/coincontrol.h index c989512d3e..edd81e590f 100644 --- a/src/wallet/coincontrol.h +++ b/src/wallet/coincontrol.h @@ -93,7 +93,7 @@ public: setSelected.insert(output); } - void Select(const COutPoint& outpoint, const CTxOut& txout) + void SelectExternal(const COutPoint& outpoint, const CTxOut& txout) { setSelected.insert(outpoint); m_external_txouts.emplace(outpoint, txout); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 8ca8f87bca..8b481bc29c 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3320,7 +3320,7 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out, } if (options.exists("solving_data")) { - UniValue solving_data = options["solving_data"].get_obj(); + const UniValue solving_data = options["solving_data"].get_obj(); if (solving_data.exists("pubkeys")) { for (const UniValue& pk_univ : solving_data["pubkeys"].get_array().getValues()) { const std::string& pk_str = pk_univ.get_str(); @@ -3328,7 +3328,7 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out, throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' is not hex", pk_str)); } const std::vector<unsigned char> data(ParseHex(pk_str)); - CPubKey pubkey(data.begin(), data.end()); + const CPubKey pubkey(data.begin(), data.end()); if (!pubkey.IsFullyValid()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' is not a valid public key", pk_str)); } @@ -3393,7 +3393,7 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out, wallet.chain().findCoins(coins); for (const auto& coin : coins) { if (!coin.second.out.IsNull()) { - coinControl.Select(coin.first, coin.second.out); + coinControl.SelectExternal(coin.first, coin.second.out); } } diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index 5bed09e067..5470177440 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -475,7 +475,7 @@ bool SelectCoins(const CWallet& wallet, const std::vector<COutput>& vAvailableCo CInputCoin coin(outpoint, txout, input_bytes); nValueFromPresetInputs += coin.txout.nValue; - if (coin.m_input_bytes <= 0) { + if (coin.m_input_bytes == -1) { return false; // Not solvable, can't estimate size for fee } coin.effective_value = coin.txout.nValue - coin_selection_params.m_effective_feerate.GetFee(coin.m_input_bytes); @@ -814,7 +814,7 @@ static bool CreateTransactionInternal( // Calculate the transaction fee TxSize tx_sizes = CalculateMaximumSignedTxSize(CTransaction(txNew), &wallet, &coin_control); int nBytes = tx_sizes.vsize; - if (nBytes < 0) { + if (nBytes == -1) { error = _("Missing solving data for estimating transaction size"); return false; } |