@@ -37,6 +37,7 @@ use bitcoin::{secp256k1, Psbt, Sequence, Txid, WPubkeyHash, Witness};
3737
3838use lightning_invoice:: RawBolt11Invoice ;
3939
40+ use crate :: chain:: chainmonitor:: PeerStorageKey ;
4041use crate :: chain:: transaction:: OutPoint ;
4142use crate :: crypto:: utils:: { hkdf_extract_expand_twice, sign, sign_with_aux_rand} ;
4243use crate :: ln:: chan_utils;
@@ -839,7 +840,7 @@ pub trait NodeSigner {
839840 ///
840841 /// Thus, if you wish to rely on recovery using this method, you should use a key which
841842 /// can be re-derived from data which would be available after state loss (eg the wallet seed)
842- fn get_peer_storage_key ( & self ) -> [ u8 ; 32 ] ;
843+ fn get_peer_storage_key ( & self ) -> PeerStorageKey ;
843844
844845 /// Get node id based on the provided [`Recipient`].
845846 ///
@@ -1780,7 +1781,7 @@ pub struct KeysManager {
17801781 shutdown_pubkey : PublicKey ,
17811782 channel_master_key : Xpriv ,
17821783 channel_child_index : AtomicUsize ,
1783- peer_storage_key : SecretKey ,
1784+ peer_storage_key : PeerStorageKey ,
17841785
17851786 #[ cfg( test) ]
17861787 pub ( crate ) entropy_source : RandomBytes ,
@@ -1890,7 +1891,7 @@ impl KeysManager {
18901891 node_id,
18911892 inbound_payment_key : ExpandedKey :: new ( inbound_pmt_key_bytes) ,
18921893
1893- peer_storage_key,
1894+ peer_storage_key : PeerStorageKey :: new ( peer_storage_key . secret_bytes ( ) ) ,
18941895
18951896 destination_script,
18961897 shutdown_pubkey,
@@ -2117,8 +2118,8 @@ impl NodeSigner for KeysManager {
21172118 self . inbound_payment_key . clone ( )
21182119 }
21192120
2120- fn get_peer_storage_key ( & self ) -> [ u8 ; 32 ] {
2121- self . peer_storage_key . secret_bytes ( )
2121+ fn get_peer_storage_key ( & self ) -> PeerStorageKey {
2122+ self . peer_storage_key . clone ( )
21222123 }
21232124
21242125 fn sign_invoice (
@@ -2282,8 +2283,8 @@ impl NodeSigner for PhantomKeysManager {
22822283 self . inbound_payment_key . clone ( )
22832284 }
22842285
2285- fn get_peer_storage_key ( & self ) -> [ u8 ; 32 ] {
2286- self . inner . peer_storage_key . secret_bytes ( )
2286+ fn get_peer_storage_key ( & self ) -> PeerStorageKey {
2287+ self . inner . peer_storage_key . clone ( )
22872288 }
22882289
22892290 fn sign_invoice (
0 commit comments