@@ -306,6 +306,11 @@ pub struct P2PArgs {
306
306
/// The path to the file where the p2p enr is stored.
307
307
#[ clap( long = "nodeenr" ) ]
308
308
pub node_enr : Option < PathBuf > ,
309
+
310
+ /// List of whitelisted ENRs (for permissioned mempools).
311
+ /// If empty, all ENRs are allowed.
312
+ #[ clap( long = "p2p.whitelist" , value_delimiter = ',' , value_parser=parse_enr) ]
313
+ pub peers_whitelist : Vec < Enr > ,
309
314
}
310
315
311
316
impl P2PArgs {
@@ -334,6 +339,7 @@ impl P2PArgs {
334
339
. enr_udp4_port ( Some ( self . udp4_port ) )
335
340
. chain_spec ( ChainSpec :: from_chain_id ( chain. id ( ) ) )
336
341
. bootnodes ( self . bootnodes . clone ( ) )
342
+ . peers_whitelist ( self . peers_whitelist . clone ( ) )
337
343
. gs_config ( gossipsub_config ( ) )
338
344
. discv5_config ( discv5:: ConfigBuilder :: new ( listen_addr. to_listen_config ( ) ) . build ( ) ) ;
339
345
@@ -778,6 +784,8 @@ mod tests {
778
784
"~/.silius/p2p/node-key" ,
779
785
"--nodeenr" ,
780
786
"~/.silius/p2p/node-enr" ,
787
+ "--p2p.whitelist" ,
788
+ & binding,
781
789
] ;
782
790
assert_eq ! (
783
791
P2PArgs {
@@ -786,9 +794,10 @@ mod tests {
786
794
p2p_broadcast_address: Some ( Ipv4Addr :: new( 127 , 0 , 0 , 1 ) ) ,
787
795
tcp4_port: 4337 ,
788
796
udp4_port: 4337 ,
789
- bootnodes: vec![ enr] ,
797
+ bootnodes: vec![ enr. clone ( ) ] ,
790
798
node_key: Some ( PathBuf :: from( "~/.silius/p2p/node-key" ) ) ,
791
- node_enr: Some ( PathBuf :: from( "~/.silius/p2p/node-enr" ) )
799
+ node_enr: Some ( PathBuf :: from( "~/.silius/p2p/node-enr" ) ) ,
800
+ peers_whitelist: vec![ enr] ,
792
801
} ,
793
802
P2PArgs :: try_parse_from( args) . unwrap( )
794
803
)
0 commit comments