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};
4
4
use util:: byte_utils;
5
5
6
6
pub ( super ) type SymmetricKey = [ u8 ; 32 ] ;
7
+
7
8
const MESSAGE_LENGTH_HEADER_SIZE : usize = 2 ;
8
9
const TAGGED_MESSAGE_LENGTH_HEADER_SIZE : usize = MESSAGE_LENGTH_HEADER_SIZE + chacha:: TAG_SIZE ;
9
10
11
+ const KEY_ROTATION_INDEX : u32 = 1000 ;
12
+
10
13
/// Returned after a successful handshake to encrypt and decrypt communication with peer nodes.
11
14
/// It should not normally be manually instantiated.
12
15
/// Automatically handles key rotation.
@@ -109,7 +112,7 @@ impl Conduit {
109
112
110
113
fn increment_nonce ( nonce : & mut u32 , chaining_key : & mut SymmetricKey , key : & mut SymmetricKey ) {
111
114
* nonce += 1 ;
112
- if * nonce == 1000 {
115
+ if * nonce == KEY_ROTATION_INDEX {
113
116
Self :: rotate_key ( chaining_key, key) ;
114
117
* nonce = 0 ;
115
118
}
You can’t perform that action at this time.
0 commit comments