Skip to content

Commit bc89d83

Browse files
committed
minor refactoring and more output
1 parent 40479db commit bc89d83

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/scala/org/ergoplatform/nodeView/history/extra/ExtraIndexer.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ trait ExtraIndexerBase extends Actor with Stash with ScorexLogging {
8686
* @param height - blockheight to get transations from
8787
* @return transactions at height
8888
*/
89-
private def getBlockTransactionsAt(height: Int): Option[BlockTransactions] =
89+
private def getBlockTransactionsAt(height: Int): Option[BlockTransactions] = {
9090
blockCache.remove(height).orElse(history.bestBlockTransactionsAt(height)).map { txs =>
9191
if (height % 1000 == 0) blockCache.keySet.filter(_ < height).map(blockCache.remove)
9292
if (readingUpTo - height < 300 && chainHeight - height > 1000) {
@@ -112,6 +112,7 @@ trait ExtraIndexerBase extends Actor with Stash with ScorexLogging {
112112
}
113113
txs
114114
}
115+
}
115116

116117
/**
117118
* Spend an IndexedErgoBox from buffer or database. Also record tokens for later use in balance tracking logic.
@@ -239,7 +240,7 @@ trait ExtraIndexerBase extends Actor with Stash with ScorexLogging {
239240
* Process a batch of BlockTransactions into memory and occasionally write them to database.
240241
*
241242
* @param state - current indexer state
242-
* @param headerOpt - header to index blocktransactions of (used after caught up with chain)
243+
* @param headerOpt - header to index block transactions of (used after caught up with chain)
243244
*/
244245
protected def index(state: IndexerState, headerOpt: Option[Header] = None): IndexerState = {
245246
val btOpt = headerOpt.flatMap { header =>
@@ -267,7 +268,7 @@ trait ExtraIndexerBase extends Actor with Stash with ScorexLogging {
267268
inputTokens.clear()
268269

269270
//process transaction inputs
270-
if (height != 1) { //only after 1st block (skip genesis box)
271+
if (height > 1) { //only after 1st block (skip genesis box)
271272
cfor(0)(_ < tx.inputs.size, _ + 1) { i =>
272273
val boxId = bytesToId(tx.inputs(i).boxId)
273274
if (findAndSpendBox(boxId, tx.id, height)) { // spend box and add tx
@@ -277,6 +278,8 @@ trait ExtraIndexerBase extends Actor with Stash with ScorexLogging {
277278
findAndUpdateToken(iEb.box.additionalTokens(j)._1.toModifierId, Left(iEb))
278279
}
279280
inputs(i) = iEb.globalIndex
281+
} else {
282+
log.warn(s"Not found input box: $boxId")
280283
}
281284
}
282285
}

0 commit comments

Comments
 (0)