File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,12 @@ use ln::peers::{chacha, hkdf};
44use util:: byte_utils;
55
66pub ( super ) type SymmetricKey = [ u8 ; 32 ] ;
7+
78const MESSAGE_LENGTH_HEADER_SIZE : usize = 2 ;
89const TAGGED_MESSAGE_LENGTH_HEADER_SIZE : usize = MESSAGE_LENGTH_HEADER_SIZE + chacha:: TAG_SIZE ;
910
11+ const KEY_ROTATION_INDEX : u32 = 1000 ;
12+
1013/// Returned after a successful handshake to encrypt and decrypt communication with peer nodes.
1114/// It should not normally be manually instantiated.
1215/// Automatically handles key rotation.
@@ -109,7 +112,7 @@ impl Conduit {
109112
110113 fn increment_nonce ( nonce : & mut u32 , chaining_key : & mut SymmetricKey , key : & mut SymmetricKey ) {
111114 * nonce += 1 ;
112- if * nonce == 1000 {
115+ if * nonce == KEY_ROTATION_INDEX {
113116 Self :: rotate_key ( chaining_key, key) ;
114117 * nonce = 0 ;
115118 }
You can’t perform that action at this time.
0 commit comments