Skip to content

Commit c46ff88

Browse files
authored
Merge pull request #4655 from wpaulino/splice-chanmon-consistency-fixes
Splice fixes for `chanmon_consistency` fuzz target
2 parents 2344577 + 099bb09 commit c46ff88

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

fuzz/src/chanmon_consistency.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ use std::sync::atomic;
102102
use std::sync::{Arc, Mutex};
103103

104104
const MAX_FEE: u32 = 10_000;
105+
const MAX_SETTLE_ITERATIONS: usize = 256;
105106
struct FuzzEstimator {
106107
ret_val: atomic::AtomicU32,
107108
}
@@ -2814,9 +2815,20 @@ impl<'a, Out: Output + MaybeSend + MaybeSync> Harness<'a, Out> {
28142815
..
28152816
} => {
28162817
let signed_tx = nodes[node_idx].wallet.sign_tx(unsigned_transaction).unwrap();
2817-
nodes[node_idx]
2818-
.funding_transaction_signed(&channel_id, &counterparty_node_id, signed_tx)
2819-
.unwrap();
2818+
match nodes[node_idx].funding_transaction_signed(
2819+
&channel_id,
2820+
&counterparty_node_id,
2821+
signed_tx,
2822+
) {
2823+
Ok(()) => {},
2824+
Err(APIError::APIMisuseError { ref err })
2825+
if err.contains("not expecting funding signatures") =>
2826+
{
2827+
// A queued signing event can be invalidated by a later `tx_abort`
2828+
// before the application handles it.
2829+
},
2830+
Err(e) => panic!("{e:?}"),
2831+
}
28202832
},
28212833
events::Event::SpliceNegotiated { new_funding_txo, .. } => {
28222834
let mut txs = nodes[node_idx].broadcaster.txn_broadcasted.borrow_mut();
@@ -2854,9 +2866,9 @@ impl<'a, Out: Output + MaybeSend + MaybeSync> Harness<'a, Out> {
28542866
fn process_all_events(&mut self) {
28552867
let mut last_pass_no_updates = false;
28562868
for i in 0..std::usize::MAX {
2857-
if i == 100 {
2869+
if i == MAX_SETTLE_ITERATIONS {
28582870
panic!(
2859-
"It may take may iterations to settle the state, but it should not take forever"
2871+
"It may take many iterations to settle the state, but it should not take forever"
28602872
);
28612873
}
28622874
let mut made_progress = self.checkpoint_manager_persistences();

0 commit comments

Comments
 (0)