@@ -60,11 +60,11 @@ export class ValidatorType1 {
6060 if ( ! this . cachedValidations . has ( id ) ) {
6161 this . cachedValidations . set ( id ,
6262 {
63- validity : true ,
63+ validity : true ,
6464 parents : [ ] ,
6565 details : null ,
6666 invalidReason : null ,
67- waiting : false
67+ waiting : false
6868 } ) ;
6969 }
7070 if ( ! this . cachedRawTransactions . has ( id ) ) {
@@ -75,7 +75,7 @@ export class ValidatorType1 {
7575 public addValidTxidFromStore ( txidHex : string ) {
7676 if ( ! this . cachedValidations . has ( txidHex ) ) {
7777 this . cachedValidations . set ( txidHex ,
78- {
78+ {
7979 validity : true ,
8080 parents : [ ] ,
8181 details : null ,
@@ -222,10 +222,18 @@ export class ValidatorType1 {
222222 this . logger . log ( "[slp-validate] Invalid Reason: " + this . cachedValidations . get ( txid ) ! . invalidReason ) ;
223223 } else if ( ! valid ) {
224224 this . logger . log ( "[slp-validate] Invalid Reason: unknown (result is user supplied)" ) ;
225- }
225+ }
226226 return valid ;
227227 }
228228
229+ public async validateSlpTransactions ( txids : string [ ] ) : Promise < string [ ] > {
230+ const res = [ ] ;
231+ for ( const txid of txids ) {
232+ res . push ( ( await this . isValidSlpTxid ( { txid } ) ) ? txid : "" ) ;
233+ }
234+ return res . filter ( ( id : string ) => id . length > 0 ) ;
235+ }
236+
229237 /**
230238 * _isValidSlpTxid
231239 *
@@ -247,7 +255,7 @@ export class ValidatorType1 {
247255 * @param tokenTypeFilter: (optional) token type of the token that should be considered valid
248256 *
249257 */
250- async _isValidSlpTxid ( txid : string , tokenIdFilter ?: string , tokenTypeFilter ?: number ) : Promise < boolean > {
258+ private async _isValidSlpTxid ( txid : string , tokenIdFilter ?: string , tokenTypeFilter ?: number ) : Promise < boolean > {
251259 // Check to see if this txn has been processed by looking at shared cache, if doesn't exist then download txn.
252260 if ( ! this . cachedValidations . has ( txid ) ) {
253261 this . cachedValidations . set ( txid , {
@@ -367,7 +375,11 @@ export class ValidatorType1 {
367375 return validation . validity ! ;
368376 }
369377 // Continue to check the NFT1 parent DAG
370- let nft_parent_dag_validity = await this . isValidSlpTxid ( { txid : inputTxid , tokenIdFilter : undefined , tokenTypeFilter : 0x81 } ) ;
378+ const nft_parent_dag_validity = await this . isValidSlpTxid ( {
379+ txid : inputTxid ,
380+ tokenIdFilter : undefined ,
381+ tokenTypeFilter : 0x81
382+ } ) ;
371383 validation . validity = nft_parent_dag_validity ;
372384 validation . waiting = false ;
373385 if ( ! nft_parent_dag_validity ) {
@@ -506,12 +518,4 @@ export class ValidatorType1 {
506518 validation . waiting = false ;
507519 return validation . validity ! ;
508520 }
509-
510- public async validateSlpTransactions ( txids : string [ ] ) : Promise < string [ ] > {
511- const res = [ ] ;
512- for ( const txid of txids ) {
513- res . push ( ( await this . isValidSlpTxid ( { txid } ) ) ? txid : "" ) ;
514- }
515- return res . filter ( ( id : string ) => id . length > 0 ) ;
516- }
517521}
0 commit comments