@@ -280,8 +280,7 @@ export class RuneUpdater implements RuneBlockIndex {
280
280
for ( const balance of balances . values ( ) ) {
281
281
const runeIdString = RuneLocation . toString ( balance . runeId ) ;
282
282
const etching =
283
- etchingByRuneId . get ( runeIdString ) ??
284
- ( await this . _storage . getEtching ( runeIdString , this . block . height - 1 ) ) ;
283
+ etchingByRuneId . get ( runeIdString ) ?? ( await this . _storage . getEtching ( runeIdString ) ) ;
285
284
if ( etching === null ) {
286
285
throw new Error ( 'Rune should exist at this point' ) ;
287
286
}
@@ -330,17 +329,31 @@ export class RuneUpdater implements RuneBlockIndex {
330
329
if ( optionRune . isSome ( ) ) {
331
330
rune = optionRune . unwrap ( ) ;
332
331
332
+ if ( rune . value < this . _minimum . value ) {
333
+ return None ;
334
+ }
335
+
336
+ if ( rune . reserved ) {
337
+ return None ;
338
+ }
339
+
333
340
if (
334
- rune . value < this . _minimum . value ||
335
- rune . reserved ||
336
341
this . etchings . find (
337
342
( etching ) => SpacedRune . fromString ( etching . runeName ) . rune . toString ( ) === rune . toString ( )
338
- ) ||
339
- ( await this . _storage . getRuneLocation ( rune . toString ( ) ) ) !== null ||
340
- ! ( await this . txCommitsToRune ( tx , rune ) )
343
+ )
341
344
) {
342
345
return None ;
343
346
}
347
+
348
+ const runeLocation = await this . _storage . getRuneLocation ( rune . toString ( ) ) ;
349
+ if ( runeLocation && runeLocation . block < this . block . height ) {
350
+ return None ;
351
+ }
352
+
353
+ const txCommitsToRune = await this . txCommitsToRune ( tx , rune ) ;
354
+ if ( ! txCommitsToRune ) {
355
+ return None ;
356
+ }
344
357
} else {
345
358
rune = Rune . getReserved ( u64 ( this . block . height ) , u32 ( txIndex ) ) ;
346
359
}
@@ -362,8 +375,7 @@ export class RuneUpdater implements RuneBlockIndex {
362
375
) ;
363
376
364
377
const etching =
365
- etchingByRuneId . get ( runeLocation ) ??
366
- ( await this . _storage . getEtching ( runeLocation , this . block . height - 1 ) ) ;
378
+ etchingByRuneId . get ( runeLocation ) ?? ( await this . _storage . getEtching ( runeLocation ) ) ;
367
379
if ( etching === null || ! etching . valid || ! etching . terms ) {
368
380
return None ;
369
381
}
0 commit comments