File tree 1 file changed +6
-3
lines changed
peripherals/eos-evm-ws-proxy
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,17 @@ class BlockMonitor extends EventEmitter {
78
78
const block = results . data [ 0 ] . result ;
79
79
const logs = results . data [ 1 ] . result ;
80
80
81
- if ( block [ "hash" ] === undefined ) {
81
+ if ( ! block || ! block [ "hash" ] ) {
82
82
throw new Error ( "missing hash in response for getBlock request of the [getBlock, GetPastLogs] batch request" ) ;
83
83
}
84
+ if ( ! Array . isArray ( logs ) ) {
85
+ throw new Error ( "invalid logs in response for GetPastLogs request of the [getBlock, GetPastLogs] batch request" ) ;
86
+ }
84
87
for ( const logEntry of logs ) {
85
- if ( logEntry [ "blockHash" ] === undefined ) {
88
+ if ( ! logEntry [ "blockHash" ] ) {
86
89
throw new Error ( "missing blockHash in response for GetPastLogs request of the [getBlock, GetPastLogs] batch request" ) ;
87
90
}
88
- else if ( logEntry [ "blockHash" ] != block [ "hash" ] ) {
91
+ else if ( logEntry [ "blockHash" ] !== block [ "hash" ] ) {
89
92
throw new Error ( "mismatched hashes in response of [getBlock, GetPastLogs] batch request" ) ;
90
93
}
91
94
}
You can’t perform that action at this time.
0 commit comments