@@ -101,7 +101,7 @@ pub struct DrReporterMsg {
101
101
pub struct Report {
102
102
/// Data Request's unique query id as known by the WitnetOracle contract
103
103
pub dr_id : DrId ,
104
- /// Timestamp at which reported result was actually generated
104
+ /// Timestamp at which the reported result was actually generated
105
105
pub dr_timestamp : u64 ,
106
106
/// Hash of the Data Request Transaction in the Witnet blockchain
107
107
pub dr_tx_hash : Hash ,
@@ -327,23 +327,26 @@ impl Handler<DrReporterMsg> for DrReporter {
327
327
}
328
328
329
329
if let Ok ( x) = eth. balance ( eth_from, None ) . await {
330
- if x < eth_from_balance {
331
- log:: warn!(
332
- "EVM address {} loss = -{} ETH" ,
333
- eth_from,
334
- Unit :: Wei ( & ( eth_from_balance - x) . to_string( ) )
335
- . to_eth_str( )
336
- . unwrap_or_default( )
337
- ) ;
338
- } else if x > eth_from_balance {
339
- log:: debug!(
340
- "EVM address {} revenue = +{} ETH" ,
341
- eth_from,
342
- Unit :: Wei ( & ( x - eth_from_balance) . to_string( ) )
343
- . to_eth_str( )
344
- . unwrap_or_default( )
345
- ) ;
346
- eth_from_balance_alert = false ;
330
+ match x. cmp ( & eth_from_balance) {
331
+ std:: cmp:: Ordering :: Less => {
332
+ log:: warn!(
333
+ "EVM address {} loss = -{} ETH" ,
334
+ eth_from,
335
+ Unit :: Wei ( & ( eth_from_balance - x) . to_string( ) )
336
+ . to_eth_str( )
337
+ . unwrap_or_default( )
338
+ ) ;
339
+ }
340
+ std:: cmp:: Ordering :: Equal | std:: cmp:: Ordering :: Greater => {
341
+ log:: debug!(
342
+ "EVM address {} revenue = +{} ETH" ,
343
+ eth_from,
344
+ Unit :: Wei ( & ( x - eth_from_balance) . to_string( ) )
345
+ . to_eth_str( )
346
+ . unwrap_or_default( )
347
+ ) ;
348
+ eth_from_balance_alert = false ;
349
+ }
347
350
}
348
351
}
349
352
@@ -386,10 +389,11 @@ fn parse_batch_report_error_log(
386
389
match ( & query_id. value , & reason. value ) {
387
390
( Token :: Uint ( query_id) , Token :: String ( reason) ) => Some ( ( * query_id, reason. to_string ( ) ) ) ,
388
391
_ => {
389
- panic ! (
392
+ log :: error !(
390
393
"Invalid BatchReportError params: {:?}" ,
391
394
batch_report_error_log_params
392
395
) ;
396
+ None
393
397
}
394
398
}
395
399
}
0 commit comments