Skip to content

Commit 32864f6

Browse files
committed
f - refactor unborn to use list of ops instead of mask
1 parent 8b32998 commit 32864f6

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ impl<'a, 'b, 'c> Node<'a, 'b, 'c> {
576576
}
577577

578578
#[cfg(test)]
579-
pub fn disable_unborn_channel_signer_ops(&self, mask: u32) {
580-
*self.keys_manager.disable_next_signer_ops.lock().unwrap() = Some(mask);
579+
pub fn disable_unborn_channel_signer_op(&self, signer_op: SignerOp) {
580+
self.keys_manager.disable_next_signer_ops.lock().unwrap().push(signer_op);
581581
}
582582
}
583583

lightning/src/ln/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ mod monitor_tests;
7979
#[cfg(test)]
8080
#[allow(unused_mut)]
8181
mod shutdown_tests;
82-
#[cfg(all(test, async_signing))]
82+
#[cfg(test)]
8383
#[allow(unused_mut)]
8484
mod async_signer_tests;
8585
#[cfg(test)]

lightning/src/util/test_utils.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ use std::time::{SystemTime, UNIX_EPOCH};
7979
use bitcoin::psbt::Psbt;
8080
use bitcoin::Sequence;
8181

82+
use super::test_channel_signer::SignerOp;
83+
8284
pub fn pubkey(byte: u8) -> PublicKey {
8385
let secp_ctx = Secp256k1::new();
8486
PublicKey::from_secret_key(&secp_ctx, &privkey(byte))
@@ -1214,8 +1216,8 @@ pub struct TestKeysInterface {
12141216
pub disable_revocation_policy_check: bool,
12151217
enforcement_states: Mutex<HashMap<[u8;32], Arc<Mutex<EnforcementState>>>>,
12161218
expectations: Mutex<Option<VecDeque<OnGetShutdownScriptpubkey>>>,
1217-
/// Holds a signer ops mask to disable for the next signer created by this interface.
1218-
pub disable_next_signer_ops: Mutex<Option<u32>>,
1219+
/// Holds a list of signer ops to disable for the next signer created by this interface.
1220+
pub disable_next_signer_ops: Mutex<Vec<SignerOp>>,
12191221
}
12201222

12211223
impl EntropySource for TestKeysInterface {
@@ -1276,8 +1278,8 @@ impl SignerProvider for TestKeysInterface {
12761278
let state = self.make_enforcement_state_cell(keys.commitment_seed);
12771279
let mut signer = TestChannelSigner::new_with_revoked(keys, state, self.disable_revocation_policy_check);
12781280
#[cfg(test)]
1279-
if let Some(mask) = self.disable_next_signer_ops.lock().unwrap().take() {
1280-
signer.disable_ops(mask)
1281+
for op in self.disable_next_signer_ops.lock().unwrap().drain(..) {
1282+
signer.disable_op(op)
12811283
}
12821284
signer
12831285
}
@@ -1317,7 +1319,7 @@ impl TestKeysInterface {
13171319
disable_revocation_policy_check: false,
13181320
enforcement_states: Mutex::new(new_hash_map()),
13191321
expectations: Mutex::new(None),
1320-
disable_next_signer_ops: Mutex::new(None),
1322+
disable_next_signer_ops: Mutex::new(vec![]),
13211323
}
13221324
}
13231325

0 commit comments

Comments
 (0)