@@ -52,9 +52,9 @@ pub const DEFAULT_COMMISSION_RATE: u64 = 200;
5252#[ serde( rename_all = "kebab-case" ) ]
5353pub struct NodeConfig {
5454 #[ serde( default = "default_authority_key_pair" ) ]
55- pub protocol_key_pair : AuthorityKeyPairWithPath ,
55+ pub authority_key_pair : AuthorityKeyPairWithPath ,
5656 #[ serde( default = "default_key_pair" ) ]
57- pub worker_key_pair : KeyPairWithPath ,
57+ pub protocol_key_pair : KeyPairWithPath ,
5858 #[ serde( default = "default_key_pair" ) ]
5959 pub account_key_pair : KeyPairWithPath ,
6060 #[ serde( default = "default_key_pair" ) ]
@@ -368,12 +368,12 @@ fn is_true(value: &bool) -> bool {
368368impl Config for NodeConfig { }
369369
370370impl NodeConfig {
371- pub fn protocol_key_pair ( & self ) -> & AuthorityKeyPair {
372- self . protocol_key_pair . authority_keypair ( )
371+ pub fn authority_key_pair ( & self ) -> & AuthorityKeyPair {
372+ self . authority_key_pair . authority_keypair ( )
373373 }
374374
375- pub fn worker_key_pair ( & self ) -> & NetworkKeyPair {
376- match self . worker_key_pair . keypair ( ) {
375+ pub fn protocol_key_pair ( & self ) -> & NetworkKeyPair {
376+ match self . protocol_key_pair . keypair ( ) {
377377 IotaKeyPair :: Ed25519 ( kp) => kp,
378378 other => panic ! (
379379 "Invalid keypair type: {:?}, only Ed25519 is allowed for worker key" ,
@@ -393,7 +393,7 @@ impl NodeConfig {
393393 }
394394
395395 pub fn protocol_public_key ( & self ) -> AuthorityPublicKeyBytes {
396- self . protocol_key_pair ( ) . public ( ) . into ( )
396+ self . authority_key_pair ( ) . public ( ) . into ( )
397397 }
398398
399399 pub fn db_path ( & self ) -> PathBuf {
@@ -1167,17 +1167,17 @@ mod tests {
11671167
11681168 #[ test]
11691169 fn load_key_pairs_to_node_config ( ) {
1170- let protocol_key_pair : AuthorityKeyPair =
1170+ let authority_key_pair : AuthorityKeyPair =
11711171 get_key_pair_from_rng ( & mut StdRng :: from_seed ( [ 0 ; 32 ] ) ) . 1 ;
1172- let worker_key_pair : NetworkKeyPair =
1172+ let protocol_key_pair : NetworkKeyPair =
11731173 get_key_pair_from_rng ( & mut StdRng :: from_seed ( [ 0 ; 32 ] ) ) . 1 ;
11741174 let network_key_pair: NetworkKeyPair =
11751175 get_key_pair_from_rng ( & mut StdRng :: from_seed ( [ 0 ; 32 ] ) ) . 1 ;
11761176
1177- write_authority_keypair_to_file ( & protocol_key_pair , PathBuf :: from ( "protocol .key" ) ) . unwrap ( ) ;
1177+ write_authority_keypair_to_file ( & authority_key_pair , PathBuf :: from ( "authority .key" ) ) . unwrap ( ) ;
11781178 write_keypair_to_file (
1179- & IotaKeyPair :: Ed25519 ( worker_key_pair . copy ( ) ) ,
1180- PathBuf :: from ( "worker .key" ) ,
1179+ & IotaKeyPair :: Ed25519 ( protocol_key_pair . copy ( ) ) ,
1180+ PathBuf :: from ( "protocol .key" ) ,
11811181 )
11821182 . unwrap ( ) ;
11831183 write_keypair_to_file (
@@ -1189,16 +1189,16 @@ mod tests {
11891189 const TEMPLATE : & str = include_str ! ( "../data/fullnode-template-with-path.yaml" ) ;
11901190 let template: NodeConfig = serde_yaml:: from_str ( TEMPLATE ) . unwrap ( ) ;
11911191 assert_eq ! (
1192- template. protocol_key_pair ( ) . public( ) ,
1193- protocol_key_pair . public( )
1192+ template. authority_key_pair ( ) . public( ) ,
1193+ authority_key_pair . public( )
11941194 ) ;
11951195 assert_eq ! (
11961196 template. network_key_pair( ) . public( ) ,
11971197 network_key_pair. public( )
11981198 ) ;
11991199 assert_eq ! (
1200- template. worker_key_pair ( ) . public( ) ,
1201- worker_key_pair . public( )
1200+ template. protocol_key_pair ( ) . public( ) ,
1201+ protocol_key_pair . public( )
12021202 ) ;
12031203 }
12041204}
0 commit comments