mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
External input fund support cleanups
Synchronize error checking for external inputs Rename external output Select to SelectExternal Const FundTransaction variables
This commit is contained in:
parent
c79d9fb2f6
commit
43568782c2
3 changed files with 6 additions and 6 deletions
|
@ -93,7 +93,7 @@ public:
|
||||||
setSelected.insert(output);
|
setSelected.insert(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Select(const COutPoint& outpoint, const CTxOut& txout)
|
void SelectExternal(const COutPoint& outpoint, const CTxOut& txout)
|
||||||
{
|
{
|
||||||
setSelected.insert(outpoint);
|
setSelected.insert(outpoint);
|
||||||
m_external_txouts.emplace(outpoint, txout);
|
m_external_txouts.emplace(outpoint, txout);
|
||||||
|
|
|
@ -3292,7 +3292,7 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.exists("solving_data")) {
|
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")) {
|
if (solving_data.exists("pubkeys")) {
|
||||||
for (const UniValue& pk_univ : solving_data["pubkeys"].get_array().getValues()) {
|
for (const UniValue& pk_univ : solving_data["pubkeys"].get_array().getValues()) {
|
||||||
const std::string& pk_str = pk_univ.get_str();
|
const std::string& pk_str = pk_univ.get_str();
|
||||||
|
@ -3300,7 +3300,7 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out,
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' is not hex", pk_str));
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' is not hex", pk_str));
|
||||||
}
|
}
|
||||||
const std::vector<unsigned char> data(ParseHex(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()) {
|
if (!pubkey.IsFullyValid()) {
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' is not a valid public key", pk_str));
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' is not a valid public key", pk_str));
|
||||||
}
|
}
|
||||||
|
@ -3365,7 +3365,7 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out,
|
||||||
wallet.chain().findCoins(coins);
|
wallet.chain().findCoins(coins);
|
||||||
for (const auto& coin : coins) {
|
for (const auto& coin : coins) {
|
||||||
if (!coin.second.out.IsNull()) {
|
if (!coin.second.out.IsNull()) {
|
||||||
coinControl.Select(coin.first, coin.second.out);
|
coinControl.SelectExternal(coin.first, coin.second.out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -475,7 +475,7 @@ bool SelectCoins(const CWallet& wallet, const std::vector<COutput>& vAvailableCo
|
||||||
|
|
||||||
CInputCoin coin(outpoint, txout, input_bytes);
|
CInputCoin coin(outpoint, txout, input_bytes);
|
||||||
nValueFromPresetInputs += coin.txout.nValue;
|
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
|
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);
|
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
|
// Calculate the transaction fee
|
||||||
TxSize tx_sizes = CalculateMaximumSignedTxSize(CTransaction(txNew), &wallet, &coin_control);
|
TxSize tx_sizes = CalculateMaximumSignedTxSize(CTransaction(txNew), &wallet, &coin_control);
|
||||||
int nBytes = tx_sizes.vsize;
|
int nBytes = tx_sizes.vsize;
|
||||||
if (nBytes < 0) {
|
if (nBytes == -1) {
|
||||||
error = _("Missing solving data for estimating transaction size");
|
error = _("Missing solving data for estimating transaction size");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue