Skip to content

[sidecar] Wrong TX index assignment #71

@liran-funaro

Description

@liran-funaro

In the relay we assign to the TX index map as follows. But this uses the txIndex from the list of valid TXs, instead of the block's TX index.
This works because all our tests have either all correct TXs or all incorrect.

for txIndex, tx := range mappedBlock.block.Txs {
	if _, loaded := r.txIDToBlkNum.LoadOrStore(tx.Id, blockNum); !loaded {
		logger.Debugf("Adding txID [%s] to in progress list", tx.GetId())
		mappedBlock.withStatus.txIDToTxIndex[tx.Id] = txIndex
		continue
	}
	logger.Debugf("txID [%s] is duplicate", tx.GetId())
	promutil.AddToCounterVec(r.metrics.transactionsStatusReceivedTotal, []string{
		protoblocktx.Status_ABORTED_DUPLICATE_TXID.String(),
	}, 1)
	mappedBlock.withStatus.pendingCount--
	mappedBlock.withStatus.txStatus[txIndex] = validationCode(protoblocktx.Status_ABORTED_DUPLICATE_TXID)
	dupIdx = append(dupIdx, txIndex)
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions