1515 */
1616
1717import { sha3_256 } from 'js-sha3' ;
18- import { combineLatest , Observable } from 'rxjs' ;
19- import { map } from 'rxjs/operators' ;
18+ import { combineLatest , Observable , of } from 'rxjs' ;
19+ import { catchError , map } from 'rxjs/operators' ;
2020import { BlockRepository } from '../infrastructure/BlockRepository' ;
2121import { ReceiptRepository } from '../infrastructure/ReceiptRepository' ;
2222import { RepositoryFactory } from '../infrastructure/RepositoryFactory' ;
@@ -49,7 +49,7 @@ export class BlockService {
4949 const merklePathItemObservable = this . blockRepository . getMerkleTransaction ( height , leaf ) ;
5050 return combineLatest ( rootHashObservable , merklePathItemObservable ) . pipe (
5151 map ( ( combined ) => this . validateInBlock ( leaf , combined [ 1 ] . merklePath , combined [ 0 ] . blockTransactionsHash ) ) ,
52- ) ;
52+ ) . pipe ( catchError ( ( ) => of ( false ) ) ) ;
5353 }
5454
5555 /**
@@ -62,7 +62,7 @@ export class BlockService {
6262 const merklePathItemObservable = this . receiptRepository . getMerkleReceipts ( height , leaf ) ;
6363 return combineLatest ( rootHashObservable , merklePathItemObservable ) . pipe (
6464 map ( ( combined ) => this . validateInBlock ( leaf , combined [ 1 ] . merklePath , combined [ 0 ] . blockReceiptsHash ) ) ,
65- ) ;
65+ ) . pipe ( catchError ( ( ) => of ( false ) ) ) ;
6666 }
6767
6868 /**
0 commit comments