@@ -1496,6 +1496,7 @@ pub struct TestKeysInterface {
14961496 expectations : Mutex < Option < VecDeque < OnGetShutdownScriptpubkey > > > ,
14971497 pub unavailable_signers_ops : Mutex < HashMap < [ u8 ; 32 ] , HashSet < SignerOp > > > ,
14981498 pub next_signer_disabled_ops : Mutex < HashSet < SignerOp > > ,
1499+ pub override_next_keys_id : Mutex < Option < [ u8 ; 32 ] > > ,
14991500}
15001501
15011502impl EntropySource for TestKeysInterface {
@@ -1546,6 +1547,13 @@ impl SignerProvider for TestKeysInterface {
15461547 type TaprootSigner = TestChannelSigner ;
15471548
15481549 fn generate_channel_keys_id ( & self , inbound : bool , user_channel_id : u128 ) -> [ u8 ; 32 ] {
1550+ let mut override_keys = self . override_next_keys_id . lock ( ) . unwrap ( ) ;
1551+
1552+ if let Some ( keys_id) = * override_keys {
1553+ // Reset after use
1554+ * override_keys = None ;
1555+ return keys_id;
1556+ }
15491557 self . backing . generate_channel_keys_id ( inbound, user_channel_id)
15501558 }
15511559
@@ -1625,6 +1633,7 @@ impl TestKeysInterface {
16251633 expectations : Mutex :: new ( None ) ,
16261634 unavailable_signers_ops : Mutex :: new ( new_hash_map ( ) ) ,
16271635 next_signer_disabled_ops : Mutex :: new ( new_hash_set ( ) ) ,
1636+ override_next_keys_id : Mutex :: new ( None ) ,
16281637 }
16291638 }
16301639
@@ -1652,6 +1661,11 @@ impl TestKeysInterface {
16521661 let cell = states. get ( & keys_id) . unwrap ( ) ;
16531662 Arc :: clone ( cell)
16541663 }
1664+
1665+ pub fn set_next_keys_id ( & self , keys_id : [ u8 ; 32 ] ) -> & Self {
1666+ * self . override_next_keys_id . lock ( ) . unwrap ( ) = Some ( keys_id) ;
1667+ self
1668+ }
16551669}
16561670
16571671impl Drop for TestKeysInterface {
0 commit comments