Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion fuzz/src/chanmon_consistency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,15 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(
}};
}

let append_dummy_tlv = |ser: Vec<u8>, dummy_type: u64| -> Vec<u8> {
use lightning::util::ser::BigSize;
let mut writer = VecWriter(ser);
BigSize(dummy_type).write(&mut writer).unwrap();
BigSize(4).write(&mut writer).unwrap();
writer.0.extend_from_slice(&[0xde, 0xad, 0xbe, 0xef]);
writer.0
};

let reload_node = |ser: &Vec<u8>,
node_id: u8,
old_monitors: &TestChainMonitor,
Expand Down Expand Up @@ -1034,8 +1043,13 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(
channel_monitors: monitor_refs,
};

let mut modified_ser = ser.clone();
if use_old_mons % 2 == 0 {
modified_ser = append_dummy_tlv(modified_ser, 0xBADF00D1);
}

let manager =
<(BlockHash, ChanMan)>::read(&mut &ser[..], read_args).expect("Failed to read manager");
<(BlockHash, ChanMan)>::read(&mut &modified_ser[..], read_args).expect("Failed to read manager");
let res = (manager.1, chain_monitor.clone());
for (channel_id, mon) in monitors.drain() {
assert_eq!(
Expand Down
2 changes: 2 additions & 0 deletions lightning/src/crypto/chacha20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ mod fuzzy_chacha {
}

pub fn process_in_place(&mut self, _input_output: &mut [u8]) {}

pub fn seek_to_block(&mut self, _block_offset: u32) {}
}
}
#[cfg(fuzzing)]
Expand Down
Loading