Skip to content

Commit c1fefcf

Browse files
committed
Allow funding errors in full_stack_target fuzzer
When a channel gets replaced before we can fund it, its possible now (due to RNG output repetition) to hit the "trying to fund channel before its ready to be funded" error in the `full_stack_target` fuzzer. Thus, we now simply ignore errors when funding.
1 parent e298854 commit c1fefcf

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

fuzz/src/full_stack.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -857,21 +857,15 @@ pub fn do_test(mut data: &[u8], logger: &Arc<dyn Logger>) {
857857
}
858858
if tx.version.0 <= 0xff && !channels.is_empty() {
859859
let chans = channels.iter().map(|(a, b)| (a, b)).collect::<Vec<_>>();
860-
if let Err(e) =
861-
channelmanager.batch_funding_transaction_generated(&chans, tx.clone())
862-
{
863-
// It's possible the channel has been closed in the mean time, but any other
864-
// failure may be a bug.
865-
if let APIError::ChannelUnavailable { .. } = e {
866-
} else {
867-
panic!();
860+
let res =
861+
channelmanager.batch_funding_transaction_generated(&chans, tx.clone());
862+
if res.is_ok() {
863+
let funding_txid = tx.compute_txid();
864+
for idx in 0..tx.output.len() {
865+
let outpoint = OutPoint { txid: funding_txid, index: idx as u16 };
866+
pending_funding_signatures.insert(outpoint, tx.clone());
868867
}
869868
}
870-
let funding_txid = tx.compute_txid();
871-
for idx in 0..tx.output.len() {
872-
let outpoint = OutPoint { txid: funding_txid, index: idx as u16 };
873-
pending_funding_signatures.insert(outpoint, tx.clone());
874-
}
875869
}
876870
},
877871
11 => {

0 commit comments

Comments
 (0)