X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Fsrc%2Fchanmon_consistency.rs;h=1d549bf76308b2124cd979a1c339a7c841ea5175;hb=9c5b3de2963a9bc381ddd51b4948235b97ecc5e6;hp=adc00ed8d8eef01439ce7db27980e537621f12d1;hpb=9a0211543762ae15ce4a0b7cb5aa3cf295a4b61f;p=rust-lightning diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index adc00ed8..1d549bf7 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -85,7 +85,7 @@ pub struct TestChannelMonitor { impl TestChannelMonitor { pub fn new(chain_monitor: Arc, broadcaster: Arc, logger: Arc, feeest: Arc) -> Self { Self { - simple_monitor: channelmonitor::SimpleManyChannelMonitor::new(chain_monitor, broadcaster, logger, feeest), + simple_monitor: Arc::new(channelmonitor::SimpleManyChannelMonitor::new(chain_monitor, broadcaster, logger, feeest)), update_ret: Mutex::new(Ok(())), latest_good_update: Mutex::new(HashMap::new()), latest_update_good: Mutex::new(HashMap::new()), @@ -150,7 +150,7 @@ impl KeysInterface for KeyProvider { PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, self.node_id]).unwrap()) } - fn get_channel_keys(&self, _inbound: bool) -> EnforcingChannelKeys { + fn get_channel_keys(&self, _inbound: bool, channel_value_satoshis: u64) -> EnforcingChannelKeys { EnforcingChannelKeys::new(InMemoryChannelKeys { funding_key: SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, self.node_id]).unwrap(), revocation_base_key: SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, self.node_id]).unwrap(), @@ -159,6 +159,7 @@ impl KeysInterface for KeyProvider { htlc_base_key: SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, self.node_id]).unwrap(), commitment_seed: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, self.node_id], remote_channel_pubkeys: None, + channel_value_satoshis, }) } @@ -190,7 +191,7 @@ pub fn do_test(data: &[u8]) { config.channel_options.fee_proportional_millionths = 0; config.channel_options.announced_channel = true; config.peer_channel_config_limits.min_dust_limit_satoshis = 0; - (ChannelManager::new(Network::Bitcoin, fee_est.clone(), monitor.clone(), broadcast.clone(), Arc::clone(&logger), keys_manager.clone(), config, 0).unwrap(), + (Arc::new(ChannelManager::new(Network::Bitcoin, fee_est.clone(), monitor.clone() as Arc, broadcast.clone(), Arc::clone(&logger), keys_manager.clone(), config, 0).unwrap()), monitor) } } } @@ -221,14 +222,14 @@ pub fn do_test(data: &[u8]) { let read_args = ChannelManagerReadArgs { keys_manager, fee_estimator: fee_est.clone(), - monitor: monitor.clone(), + monitor: monitor.clone() as Arc, tx_broadcaster: broadcast.clone(), logger, default_config: config, channel_monitors: &mut monitor_refs, }; - let res = (<(Sha256d, ChannelManager)>::read(&mut Cursor::new(&$ser.0), read_args).expect("Failed to read manager").1, monitor); + let res = (<(Sha256d, ChannelManager>)>::read(&mut Cursor::new(&$ser.0), read_args).expect("Failed to read manager").1, monitor); for (_, was_good) in $old_monitors.latest_updates_good_at_last_ser.lock().unwrap().iter() { if !was_good { // If the last time we updated a monitor we didn't successfully update (and we @@ -420,7 +421,7 @@ pub fn do_test(data: &[u8]) { fee_msat: 5000000, cltv_expiry_delta: 200, }], - }, PaymentHash(payment_hash.into_inner())) { + }, PaymentHash(payment_hash.into_inner()), None) { // Probably ran out of funds test_return!(); } @@ -444,7 +445,7 @@ pub fn do_test(data: &[u8]) { fee_msat: 5000000, cltv_expiry_delta: 200, }], - }, PaymentHash(payment_hash.into_inner())) { + }, PaymentHash(payment_hash.into_inner()), None) { // Probably ran out of funds test_return!(); } @@ -605,9 +606,9 @@ pub fn do_test(data: &[u8]) { events::Event::PaymentReceived { payment_hash, .. } => { if claim_set.insert(payment_hash.0) { if $fail { - assert!(nodes[$node].fail_htlc_backwards(&payment_hash)); + assert!(nodes[$node].fail_htlc_backwards(&payment_hash, &None)); } else { - assert!(nodes[$node].claim_funds(PaymentPreimage(payment_hash.0), 5_000_000)); + assert!(nodes[$node].claim_funds(PaymentPreimage(payment_hash.0), &None, 5_000_000)); } } },