@@ -722,6 +722,9 @@ pub(crate) struct ChannelMonitorImpl<Signer: Sign> {
722722 // the full block_connected).
723723 best_block : BestBlock ,
724724
725+ /// The node_id of our counterparty
726+ counterparty_node_id : Option < PublicKey > ,
727+
725728 secp_ctx : Secp256k1 < secp256k1:: All > , //TODO: dedup this a bit...
726729}
727730
@@ -954,6 +957,7 @@ impl<Signer: Sign> Writeable for ChannelMonitorImpl<Signer> {
954957 ( 3 , self . htlcs_resolved_on_chain, vec_type) ,
955958 ( 5 , self . pending_monitor_events, vec_type) ,
956959 ( 7 , self . funding_spend_seen, required) ,
960+ ( 9 , self . counterparty_node_id, option) ,
957961 } ) ;
958962
959963 Ok ( ( ) )
@@ -967,7 +971,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
967971 funding_redeemscript : Script , channel_value_satoshis : u64 ,
968972 commitment_transaction_number_obscure_factor : u64 ,
969973 initial_holder_commitment_tx : HolderCommitmentTransaction ,
970- best_block : BestBlock ) -> ChannelMonitor < Signer > {
974+ best_block : BestBlock , counterparty_node_id : PublicKey ) -> ChannelMonitor < Signer > {
971975
972976 assert ! ( commitment_transaction_number_obscure_factor <= ( 1 << 48 ) ) ;
973977 let payment_key_hash = WPubkeyHash :: hash ( & keys. pubkeys ( ) . payment_point . serialize ( ) ) ;
@@ -1057,6 +1061,7 @@ impl<Signer: Sign> ChannelMonitor<Signer> {
10571061 htlcs_resolved_on_chain : Vec :: new ( ) ,
10581062
10591063 best_block,
1064+ counterparty_node_id : Some ( counterparty_node_id) ,
10601065
10611066 secp_ctx,
10621067 } ) ,
@@ -3336,11 +3341,13 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
33363341 let mut funding_spend_confirmed = None ;
33373342 let mut htlcs_resolved_on_chain = Some ( Vec :: new ( ) ) ;
33383343 let mut funding_spend_seen = Some ( false ) ;
3344+ let mut counterparty_node_id = None ;
33393345 read_tlv_fields ! ( reader, {
33403346 ( 1 , funding_spend_confirmed, option) ,
33413347 ( 3 , htlcs_resolved_on_chain, vec_type) ,
33423348 ( 5 , pending_monitor_events, vec_type) ,
33433349 ( 7 , funding_spend_seen, option) ,
3350+ ( 9 , counterparty_node_id, option) ,
33443351 } ) ;
33453352
33463353 let mut secp_ctx = Secp256k1 :: new ( ) ;
@@ -3395,6 +3402,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
33953402 htlcs_resolved_on_chain : htlcs_resolved_on_chain. unwrap ( ) ,
33963403
33973404 best_block,
3405+ counterparty_node_id,
33983406
33993407 secp_ctx,
34003408 } ) ,
@@ -3631,7 +3639,7 @@ mod tests {
36313639 ( OutPoint { txid : Txid :: from_slice ( & [ 43 ; 32 ] ) . unwrap ( ) , index : 0 } , Script :: new ( ) ) ,
36323640 & channel_parameters,
36333641 Script :: new ( ) , 46 , 0 ,
3634- HolderCommitmentTransaction :: dummy ( ) , best_block) ;
3642+ HolderCommitmentTransaction :: dummy ( ) , best_block, dummy_key ) ;
36353643
36363644 monitor. provide_latest_holder_commitment_tx ( HolderCommitmentTransaction :: dummy ( ) , preimages_to_holder_htlcs ! ( preimages[ 0 ..10 ] ) ) . unwrap ( ) ;
36373645 let dummy_txid = dummy_tx. txid ( ) ;
0 commit comments