|
|
@ -47,7 +47,8 @@ static feebumper::Result PreconditionChecks(const CWallet& wallet, const CWallet
|
|
|
|
|
|
|
|
|
|
|
|
// check that original tx consists entirely of our inputs
|
|
|
|
// check that original tx consists entirely of our inputs
|
|
|
|
// if not, we can't bump the fee, because the wallet has no way of knowing the value of the other inputs (thus the fee)
|
|
|
|
// if not, we can't bump the fee, because the wallet has no way of knowing the value of the other inputs (thus the fee)
|
|
|
|
if (!wallet.IsAllFromMe(*wtx.tx, ISMINE_SPENDABLE)) {
|
|
|
|
isminefilter filter = wallet.GetLegacyScriptPubKeyMan() && wallet.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) ? ISMINE_WATCH_ONLY : ISMINE_SPENDABLE;
|
|
|
|
|
|
|
|
if (!wallet.IsAllFromMe(*wtx.tx, filter)) {
|
|
|
|
errors.push_back("Transaction contains inputs that don't belong to this wallet");
|
|
|
|
errors.push_back("Transaction contains inputs that don't belong to this wallet");
|
|
|
|
return feebumper::Result::WALLET_ERROR;
|
|
|
|
return feebumper::Result::WALLET_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -78,7 +79,8 @@ static feebumper::Result CheckFeeRate(const CWallet& wallet, const CWalletTx& wt
|
|
|
|
CFeeRate incrementalRelayFee = std::max(wallet.chain().relayIncrementalFee(), CFeeRate(WALLET_INCREMENTAL_RELAY_FEE));
|
|
|
|
CFeeRate incrementalRelayFee = std::max(wallet.chain().relayIncrementalFee(), CFeeRate(WALLET_INCREMENTAL_RELAY_FEE));
|
|
|
|
|
|
|
|
|
|
|
|
// Given old total fee and transaction size, calculate the old feeRate
|
|
|
|
// Given old total fee and transaction size, calculate the old feeRate
|
|
|
|
CAmount old_fee = wtx.GetDebit(ISMINE_SPENDABLE) - wtx.tx->GetValueOut();
|
|
|
|
isminefilter filter = wallet.GetLegacyScriptPubKeyMan() && wallet.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) ? ISMINE_WATCH_ONLY : ISMINE_SPENDABLE;
|
|
|
|
|
|
|
|
CAmount old_fee = wtx.GetDebit(filter) - wtx.tx->GetValueOut();
|
|
|
|
const int64_t txSize = GetVirtualTransactionSize(*(wtx.tx));
|
|
|
|
const int64_t txSize = GetVirtualTransactionSize(*(wtx.tx));
|
|
|
|
CFeeRate nOldFeeRate(old_fee, txSize);
|
|
|
|
CFeeRate nOldFeeRate(old_fee, txSize);
|
|
|
|
// Min total fee is old fee + relay fee
|
|
|
|
// Min total fee is old fee + relay fee
|
|
|
@ -195,7 +197,8 @@ Result CreateTotalBumpTransaction(const CWallet* wallet, const uint256& txid, co
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// calculate the old fee and fee-rate
|
|
|
|
// calculate the old fee and fee-rate
|
|
|
|
old_fee = wtx.GetDebit(ISMINE_SPENDABLE) - wtx.tx->GetValueOut();
|
|
|
|
isminefilter filter = wallet->GetLegacyScriptPubKeyMan() && wallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) ? ISMINE_WATCH_ONLY : ISMINE_SPENDABLE;
|
|
|
|
|
|
|
|
old_fee = wtx.GetDebit(filter) - wtx.tx->GetValueOut();
|
|
|
|
CFeeRate nOldFeeRate(old_fee, txSize);
|
|
|
|
CFeeRate nOldFeeRate(old_fee, txSize);
|
|
|
|
// The wallet uses a conservative WALLET_INCREMENTAL_RELAY_FEE value to
|
|
|
|
// The wallet uses a conservative WALLET_INCREMENTAL_RELAY_FEE value to
|
|
|
|
// future proof against changes to network wide policy for incremental relay
|
|
|
|
// future proof against changes to network wide policy for incremental relay
|
|
|
@ -308,7 +311,8 @@ Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
old_fee = wtx.GetDebit(ISMINE_SPENDABLE) - wtx.tx->GetValueOut();
|
|
|
|
isminefilter filter = wallet.GetLegacyScriptPubKeyMan() && wallet.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) ? ISMINE_WATCH_ONLY : ISMINE_SPENDABLE;
|
|
|
|
|
|
|
|
old_fee = wtx.GetDebit(filter) - wtx.tx->GetValueOut();
|
|
|
|
|
|
|
|
|
|
|
|
if (coin_control.m_feerate) {
|
|
|
|
if (coin_control.m_feerate) {
|
|
|
|
// The user provided a feeRate argument.
|
|
|
|
// The user provided a feeRate argument.
|
|
|
|