@@ -101,7 +101,7 @@ pub struct DrReporterMsg {
101101pub struct Report {
102102 /// Data Request's unique query id as known by the WitnetOracle contract
103103 pub dr_id : DrId ,
104- /// Timestamp at which reported result was actually generated
104+ /// Timestamp at which the reported result was actually generated
105105 pub dr_timestamp : u64 ,
106106 /// Hash of the Data Request Transaction in the Witnet blockchain
107107 pub dr_tx_hash : Hash ,
@@ -327,23 +327,26 @@ impl Handler<DrReporterMsg> for DrReporter {
327327 }
328328
329329 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+ }
347350 }
348351 }
349352
@@ -386,10 +389,11 @@ fn parse_batch_report_error_log(
386389 match ( & query_id. value , & reason. value ) {
387390 ( Token :: Uint ( query_id) , Token :: String ( reason) ) => Some ( ( * query_id, reason. to_string ( ) ) ) ,
388391 _ => {
389- panic ! (
392+ log :: error !(
390393 "Invalid BatchReportError params: {:?}" ,
391394 batch_report_error_log_params
392395 ) ;
396+ None
393397 }
394398 }
395399}
0 commit comments