File tree Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " fortuna"
3
- version = " 5.0 .0"
3
+ version = " 5.1 .0"
4
4
edition = " 2021"
5
5
6
6
[dependencies ]
Original file line number Diff line number Diff line change @@ -127,7 +127,6 @@ pub async fn run(opts: &RunOptions) -> Result<()> {
127
127
. provider_config
128
128
. as_ref ( )
129
129
. map ( |path| ProviderConfig :: load ( & path) . expect ( "Failed to load provider config" ) ) ;
130
- let private_key = opts. load_private_key ( ) ?;
131
130
let secret = opts. randomness . load_secret ( ) ?;
132
131
let ( tx_exit, rx_exit) = watch:: channel ( false ) ;
133
132
@@ -141,7 +140,6 @@ pub async fn run(opts: &RunOptions) -> Result<()> {
141
140
. as_ref ( )
142
141
. map ( |c| c. get_sorted_commitments ( ) )
143
142
. unwrap_or_else ( || Vec :: new ( ) ) ;
144
- println ! ( "{} {:?}" , chain_id, provider_commitments) ;
145
143
146
144
let provider_info = contract. get_provider_info ( opts. provider ) . call ( ) . await ?;
147
145
let latest_metadata =
@@ -212,7 +210,10 @@ pub async fn run(opts: &RunOptions) -> Result<()> {
212
210
213
211
Ok :: < ( ) , Error > ( ( ) )
214
212
} ) ;
215
- spawn ( run_keeper ( chains. clone ( ) , config, private_key) ) ;
213
+
214
+ if let Some ( keeper_private_key) = opts. load_keeper_private_key ( ) ? {
215
+ spawn ( run_keeper ( chains. clone ( ) , config, keeper_private_key) ) ;
216
+ }
216
217
217
218
run_api ( opts. addr . clone ( ) , chains, rx_exit) . await ?;
218
219
Original file line number Diff line number Diff line change @@ -36,16 +36,20 @@ pub struct RunOptions {
36
36
#[ arg( env = "FORTUNA_PROVIDER" ) ]
37
37
pub provider : Address ,
38
38
39
- /// Path to a file containing a 20-byte (40 char) hex encoded Ethereum private key.
39
+ /// If provided, the keeper will run alongside the Fortuna API service.
40
+ /// It should be a path to a file containing a 20-byte (40 char) hex encoded Ethereum private key.
40
41
/// This key is required to submit transactions for entropy callback requests.
41
42
/// This key should not be a registered provider.
42
43
#[ arg( long = "keeper-private-key" ) ]
43
44
#[ arg( env = "KEEPER_PRIVATE_KEY" ) ]
44
- pub keeper_private_key_file : String ,
45
+ pub keeper_private_key_file : Option < String > ,
45
46
}
46
47
47
48
impl RunOptions {
48
- pub fn load_private_key ( & self ) -> Result < String > {
49
- return Ok ( ( fs:: read_to_string ( & self . keeper_private_key_file ) ) ?) ;
49
+ pub fn load_keeper_private_key ( & self ) -> Result < Option < String > > {
50
+ if let Some ( ref keeper_private_key_file) = self . keeper_private_key_file {
51
+ return Ok ( Some ( fs:: read_to_string ( keeper_private_key_file) ?) ) ;
52
+ }
53
+ return Ok ( None ) ;
50
54
}
51
55
}
You can’t perform that action at this time.
0 commit comments