Skip to content

Commit 99e5396

Browse files
committed
Merge bitcoin/bitcoin#23188: wallet: fund transaction external input cleanups
4356878 External input fund support cleanups (Gregory Sanders) Pull request description: Minor cleanups to bitcoin/bitcoin#17211 ACKs for top commit: achow101: ACK 4356878 meshcollider: utACK 4356878 benthecarman: ACK 4356878 Tree-SHA512: 865f8a3804f8c0027f5393a0539041158166a919378f2c3bc99b936843eee2329372bcc2af888fa62babfa5f6baf4f13d4cfef7b4e26a7265a82a908f9719ad6
2 parents 991753e + 4356878 commit 99e5396

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/wallet/coincontrol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class CCoinControl
9393
setSelected.insert(output);
9494
}
9595

96-
void Select(const COutPoint& outpoint, const CTxOut& txout)
96+
void SelectExternal(const COutPoint& outpoint, const CTxOut& txout)
9797
{
9898
setSelected.insert(outpoint);
9999
m_external_txouts.emplace(outpoint, txout);

src/wallet/rpcwallet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3320,15 +3320,15 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out,
33203320
}
33213321

33223322
if (options.exists("solving_data")) {
3323-
UniValue solving_data = options["solving_data"].get_obj();
3323+
const UniValue solving_data = options["solving_data"].get_obj();
33243324
if (solving_data.exists("pubkeys")) {
33253325
for (const UniValue& pk_univ : solving_data["pubkeys"].get_array().getValues()) {
33263326
const std::string& pk_str = pk_univ.get_str();
33273327
if (!IsHex(pk_str)) {
33283328
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' is not hex", pk_str));
33293329
}
33303330
const std::vector<unsigned char> data(ParseHex(pk_str));
3331-
CPubKey pubkey(data.begin(), data.end());
3331+
const CPubKey pubkey(data.begin(), data.end());
33323332
if (!pubkey.IsFullyValid()) {
33333333
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' is not a valid public key", pk_str));
33343334
}
@@ -3393,7 +3393,7 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out,
33933393
wallet.chain().findCoins(coins);
33943394
for (const auto& coin : coins) {
33953395
if (!coin.second.out.IsNull()) {
3396-
coinControl.Select(coin.first, coin.second.out);
3396+
coinControl.SelectExternal(coin.first, coin.second.out);
33973397
}
33983398
}
33993399

src/wallet/spend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ bool SelectCoins(const CWallet& wallet, const std::vector<COutput>& vAvailableCo
475475

476476
CInputCoin coin(outpoint, txout, input_bytes);
477477
nValueFromPresetInputs += coin.txout.nValue;
478-
if (coin.m_input_bytes <= 0) {
478+
if (coin.m_input_bytes == -1) {
479479
return false; // Not solvable, can't estimate size for fee
480480
}
481481
coin.effective_value = coin.txout.nValue - coin_selection_params.m_effective_feerate.GetFee(coin.m_input_bytes);
@@ -814,7 +814,7 @@ static bool CreateTransactionInternal(
814814
// Calculate the transaction fee
815815
TxSize tx_sizes = CalculateMaximumSignedTxSize(CTransaction(txNew), &wallet, &coin_control);
816816
int nBytes = tx_sizes.vsize;
817-
if (nBytes < 0) {
817+
if (nBytes == -1) {
818818
error = _("Missing solving data for estimating transaction size");
819819
return false;
820820
}

0 commit comments

Comments
 (0)