mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-09 14:18:58 +02:00
wallet: Retrieve TXO directly in FetchSelectedInputs
Instead of searching mapWallet for the preselected inputs, search m_txos. wallet_fundrawtransaction.py spends external inputs and needs the change output to also belong to the test wallet for the oversized tx test.
This commit is contained in:
@@ -277,12 +277,8 @@ util::Result<PreSelectedInputs> FetchSelectedInputs(const CWallet& wallet, const
|
||||
input_bytes = GetVirtualTransactionSize(input_bytes, 0, 0);
|
||||
}
|
||||
CTxOut txout;
|
||||
if (auto ptr_wtx = wallet.GetWalletTx(outpoint.hash)) {
|
||||
// Clearly invalid input, fail
|
||||
if (ptr_wtx->tx->vout.size() <= outpoint.n) {
|
||||
return util::Error{strprintf(_("Invalid pre-selected input %s"), outpoint.ToString())};
|
||||
}
|
||||
txout = ptr_wtx->tx->vout.at(outpoint.n);
|
||||
if (auto txo = wallet.GetTXO(outpoint)) {
|
||||
txout = txo->GetTxOut();
|
||||
if (input_bytes == -1) {
|
||||
input_bytes = CalculateMaximumSignedInputSize(txout, &wallet, &coin_control);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user