File tree 2 files changed +14
-7
lines changed
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -617,8 +617,10 @@ export class Bit {
617
617
// handle next item in the pruning stack
618
618
let pruningStack = PruneStack ( ) ;
619
619
let tokenIdsPruned = pruningStack . newBlock ( index ) ;
620
- for ( let tokenId of tokenIdsPruned ) {
621
- self . _tokenIdsModified . add ( tokenId ) ;
620
+ if ( tokenIdsPruned ) {
621
+ for ( let tokenId of tokenIdsPruned ) {
622
+ self . _tokenIdsModified . add ( tokenId ) ;
623
+ }
622
624
}
623
625
624
626
console . time ( '[PERF] RPC END ' + index ) ;
Original file line number Diff line number Diff line change @@ -24,13 +24,18 @@ class _PruningStack {
24
24
}
25
25
26
26
// This should be at start of block crawl().
27
- public newBlock ( blockIndex : number ) : IterableIterator < TokenId > {
28
- let blocks = Array . from ( this . _stack . keys ( ) ) ;
29
- let nextBlock = blocks [ 0 ] ;
30
- let pruneMap = this . _stack . get ( nextBlock ) ! ;
27
+ public newBlock ( blockIndex : number ) : IterableIterator < TokenId > | null {
28
+ let nextBlock = Array . from ( this . _stack . keys ( ) ) [ 0 ] ;
29
+ let pruneMap = this . _stack . get ( nextBlock ) ;
30
+ if ( ! pruneMap ) {
31
+ console . log ( `[WARN] No pruneMap for ${ nextBlock } .` ) ;
32
+ console . log ( `[WARN] PruneStack Keys: ${ Array . from ( this . _stack . keys ( ) ) } before adding ${ blockIndex } ` ) ;
33
+ this . _stack . set ( blockIndex , new Map ( ) ) ;
34
+ return null ;
35
+ }
31
36
console . log ( `[INFO] Prune stack at ${ blockIndex } , about to pop ${ nextBlock } .` ) ;
32
- this . _stack . set ( blockIndex , new Map ( ) ) ;
33
37
this . _considerPruningMap ( pruneMap , blockIndex ) ;
38
+ this . _stack . set ( blockIndex , new Map ( ) ) ;
34
39
return pruneMap . keys ( ) ;
35
40
}
36
41
You can’t perform that action at this time.
0 commit comments