Skip to content

Commit 893735a

Browse files
committed
Improve error handling in deposit_status by returning an error if vout is not found for the deposit transaction
1 parent a7a64cf commit 893735a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/cli.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,20 @@ pub async fn deposit_status(
263263

264264
let (vout, found) = match tx_details {
265265
Ok((tx, _, _)) => {
266-
let vout = tx
266+
match tx
267267
.output
268268
.iter()
269-
.position(|o| o.script_pubkey == taproot_address.script_pubkey());
270-
(vout.map(|v| v as u32).unwrap_or(0), vout.is_some())
269+
.position(|o| o.script_pubkey == taproot_address.script_pubkey())
270+
{
271+
Some(v) => (v as u32, true),
272+
None => {
273+
return Err(BridgeCliError::Eyre(eyre!(
274+
"Could not find vout for deposit txid {} and address {}",
275+
status.txid,
276+
taproot_address
277+
)));
278+
}
279+
}
271280
}
272281
Err(_) => (0, false),
273282
};

0 commit comments

Comments
 (0)