Skip to content

Commit

Permalink
f fuzz DynSigner
Browse files Browse the repository at this point in the history
  • Loading branch information
devrandom committed Sep 24, 2024
1 parent ac17822 commit ad37be8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fuzz/src/chanmon_consistency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ use bitcoin::secp256k1::schnorr;
use bitcoin::secp256k1::{self, Message, PublicKey, Scalar, Secp256k1, SecretKey};

use lightning::io::Cursor;
use std::cmp::{self, Ordering};
use std::mem;
use std::sync::atomic;
use std::sync::{Arc, Mutex};
use std::cmp::{self, Ordering};
use bitcoin::bech32::u5;
use lightning::util::dyn_signer::DynSigner;

const MAX_FEE: u32 = 10_000;
struct FuzzEstimator {
Expand Down Expand Up @@ -391,6 +393,7 @@ impl SignerProvider for KeyProvider {
channel_keys_id,
);
let revoked_commitment = self.make_enforcement_state_cell(keys.commitment_seed);
let keys = DynSigner::new(keys);
TestChannelSigner::new_with_revoked(keys, revoked_commitment, false)
}

Expand All @@ -399,6 +402,7 @@ impl SignerProvider for KeyProvider {

let inner: InMemorySigner = ReadableArgs::read(&mut reader, self)?;
let state = self.make_enforcement_state_cell(inner.commitment_seed);
let inner = DynSigner::new(inner);

Ok(TestChannelSigner::new_with_revoked(inner, state, false))
}
Expand Down
2 changes: 2 additions & 0 deletions fuzz/src/full_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ use std::cmp;
use std::convert::TryInto;
use std::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use lightning::util::dyn_signer::DynSigner;

#[inline]
#[rustfmt::skip]
Expand Down Expand Up @@ -536,6 +537,7 @@ impl SignerProvider for KeyProvider {
fn read_chan_signer(&self, mut data: &[u8]) -> Result<TestChannelSigner, DecodeError> {
let inner: InMemorySigner = ReadableArgs::read(&mut data, self)?;
let state = Arc::new(Mutex::new(EnforcementState::new()));
let inner = DynSigner::new(inner);

Ok(TestChannelSigner::new_with_revoked(inner, state, false))
}
Expand Down

0 comments on commit ad37be8

Please sign in to comment.