Skip to content

Commit f143e1f

Browse files
committed
Raise error for UnknownUtxo
1 parent 8a08bf5 commit f143e1f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/wallet/mod.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,13 +1754,14 @@ impl Wallet {
17541754
.drain(..)
17551755
.map(|txin| -> Result<_, BuildFeeBumpError> {
17561756
let outpoint = txin.previous_output;
1757-
let prev_txout = tx_graph.get_txout(outpoint).cloned();
1758-
match prev_txout.as_ref().and_then(|prev_txout| {
1759-
txout_index.index_of_spk(prev_txout.script_pubkey.clone())
1760-
}) {
1757+
let prev_txout = tx_graph
1758+
.get_txout(outpoint)
1759+
.cloned()
1760+
.ok_or(BuildFeeBumpError::UnknownUtxo(outpoint))?;
1761+
match txout_index.index_of_spk(prev_txout.script_pubkey.clone()) {
17611762
// This is a local utxo.
17621763
Some(&(keychain, derivation_index)) => {
1763-
let txout = prev_txout.ok_or(BuildFeeBumpError::UnknownUtxo(outpoint))?;
1764+
let txout = prev_txout;
17641765
let chain_position = chain_positions
17651766
.get(&outpoint.txid)
17661767
.cloned()
@@ -1790,9 +1791,9 @@ impl Wallet {
17901791
sequence: txin.sequence,
17911792
psbt_input: Box::new(psbt::Input {
17921793
witness_utxo: prev_txout
1793-
.as_ref()
1794-
.and_then(|txout| txout.script_pubkey.witness_version())
1795-
.and(prev_txout),
1794+
.script_pubkey
1795+
.witness_version()
1796+
.map(|_| prev_txout),
17961797
non_witness_utxo: tx_graph
17971798
.get_tx(outpoint.txid)
17981799
.map(|tx| tx.as_ref().clone()),

0 commit comments

Comments
 (0)