Skip to content

Commit c04a038

Browse files
committed
Fixing fuzztest target after new bitcoin crate version
1 parent d4eea7b commit c04a038

File tree

5 files changed

+7
-15
lines changed

5 files changed

+7
-15
lines changed

fuzz/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ stdin_fuzz = []
1919
[dependencies]
2020
afl = { version = "0.4", optional = true }
2121
lightning = { path = "../lightning", features = ["fuzztarget"] }
22-
bitcoin = { version = "0.21", features = ["fuzztarget"] }
23-
bitcoin_hashes = { version = "0.7", features = ["fuzztarget"] }
22+
bitcoin = { version = "0.23", features = ["fuzztarget"] }
2423
hex = "0.3"
2524
honggfuzz = { version = "0.5", optional = true }
26-
secp256k1 = { version = "0.15", features=["fuzztarget"] }
2725
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git", optional = true }
2826

2927
[build-dependencies]

fuzz/src/chanmon_consistency.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ use bitcoin::network::constants::Network;
1818

1919
use bitcoin::hashes::Hash as TraitImport;
2020
use bitcoin::hashes::sha256::Hash as Sha256;
21-
use bitcoin::hashes::sha256d::Hash as Sha256d;
22-
use bitcoin::hash_types::WPubkeyHash;
21+
use bitcoin::hash_types::{BlockHash, WPubkeyHash};
2322

2423
use lightning::chain::chaininterface;
2524
use lightning::chain::transaction::OutPoint;
@@ -114,7 +113,7 @@ impl channelmonitor::ManyChannelMonitor<EnforcingChannelKeys> for TestChannelMon
114113
hash_map::Entry::Occupied(entry) => entry,
115114
hash_map::Entry::Vacant(_) => panic!("Didn't have monitor on update call"),
116115
};
117-
let mut deserialized_monitor = <(Sha256d, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::
116+
let mut deserialized_monitor = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::
118117
read(&mut Cursor::new(&map_entry.get().1), Arc::clone(&self.logger)).unwrap().1;
119118
deserialized_monitor.update_monitor(update.clone(), &&TestBroadcaster {}).unwrap();
120119
let mut ser = VecWriter(Vec::new());
@@ -215,7 +214,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
215214
let mut monitors = HashMap::new();
216215
let mut old_monitors = $old_monitors.latest_monitors.lock().unwrap();
217216
for (outpoint, (update_id, monitor_ser)) in old_monitors.drain() {
218-
monitors.insert(outpoint, <(Sha256d, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&monitor_ser), Arc::clone(&logger)).expect("Failed to read monitor").1);
217+
monitors.insert(outpoint, <(BlockHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&monitor_ser), Arc::clone(&logger)).expect("Failed to read monitor").1);
219218
monitor.latest_monitors.lock().unwrap().insert(outpoint, (update_id, monitor_ser));
220219
}
221220
let mut monitor_refs = HashMap::new();
@@ -233,7 +232,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
233232
channel_monitors: &mut monitor_refs,
234233
};
235234

236-
(<(Sha256d, ChannelManager<EnforcingChannelKeys, Arc<TestChannelMonitor>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>>)>::read(&mut Cursor::new(&$ser.0), read_args).expect("Failed to read manager").1, monitor)
235+
(<(BlockHash, ChannelManager<EnforcingChannelKeys, Arc<TestChannelMonitor>, Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>>)>::read(&mut Cursor::new(&$ser.0), read_args).expect("Failed to read manager").1, monitor)
237236
} }
238237
}
239238

fuzz/src/full_stack.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use bitcoin::util::hash::BitcoinHash;
1515
use bitcoin::hashes::Hash as TraitImport;
1616
use bitcoin::hashes::HashEngine as TraitImportEngine;
1717
use bitcoin::hashes::sha256::Hash as Sha256;
18-
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
1918
use bitcoin::hash_types::{Txid, BlockHash, WPubkeyHash};
2019

2120
use lightning::chain::chaininterface::{BroadcasterInterface,ConfirmationTarget,ChainListener,FeeEstimator,ChainWatchInterfaceUtil};
@@ -38,7 +37,6 @@ use bitcoin::secp256k1::Secp256k1;
3837
use std::cell::RefCell;
3938
use std::collections::{HashMap, hash_map};
4039
use std::cmp;
41-
use std::hash::Hash;
4240
use std::sync::Arc;
4341
use std::sync::atomic::{AtomicU64,AtomicUsize,Ordering};
4442

@@ -129,7 +127,7 @@ impl<'a> PartialEq for Peer<'a> {
129127
}
130128
}
131129
impl<'a> Eq for Peer<'a> {}
132-
impl<'a> Hash for Peer<'a> {
130+
impl<'a> std::hash::Hash for Peer<'a> {
133131
fn hash<H : std::hash::Hasher>(&self, h: &mut H) {
134132
self.id.hash(h)
135133
}

fuzz/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
extern crate bitcoin;
2-
extern crate bitcoin_hashes;
32
extern crate lightning;
4-
extern crate secp256k1;
53
extern crate hex;
64

75
pub mod utils;

fuzz/src/router.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
21
use bitcoin::blockdata::script::{Script, Builder};
32
use bitcoin::blockdata::block::Block;
43
use bitcoin::blockdata::transaction::Transaction;
5-
use bitcoin::hash_types::{Txid, BlockHash}
4+
use bitcoin::hash_types::{Txid, BlockHash};
65

76
use lightning::chain::chaininterface::{ChainError,ChainWatchInterface};
87
use lightning::ln::channelmanager::ChannelDetails;

0 commit comments

Comments
 (0)