Skip to content

Commit ef1806c

Browse files
committed
fixup: Serialise ChannelMonitors and send them over inside Peer Storage
1 parent 9f5940a commit ef1806c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lightning/src/chain/chainmonitor.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,11 @@ where
838838
match write_util(&chan_mon, true, &mut ser_chan) {
839839
Ok(_) => {
840840
// Adding size of peer_storage_monitor.
841-
curr_size += ser_chan.0.len() + 32 + 8 + 32 + 14;
841+
curr_size += ser_chan.0.serialized_length()
842+
+ min_seen_secret.serialized_length()
843+
+ chan_id.serialized_length()
844+
+ counterparty_node_id.serialized_length();
845+
842846
if curr_size > MAX_PEER_STORAGE_SIZE {
843847
break;
844848
}
@@ -858,8 +862,7 @@ where
858862
}
859863
}
860864

861-
let mut serialised_channels = Vec::new();
862-
monitors_list.write(&mut serialised_channels).unwrap();
865+
let serialised_channels = monitors_list.encode();
863866
let our_peer_storage = DecryptedOurPeerStorage::new(serialised_channels);
864867
let cipher = our_peer_storage.encrypt(&self.our_peerstorage_encryption_key, &random_bytes);
865868

0 commit comments

Comments
 (0)