Skip to content

Commit

Permalink
Remove redundant liveness and duplicate checks in txHandler. (#523)
Browse files Browse the repository at this point in the history
As of the transaction pool refactor, transactionPool.Test already performs
duplicate detection and transaction liveness checks.
  • Loading branch information
derbear committed Nov 15, 2019
1 parent c539162 commit 1222702
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
26 changes: 0 additions & 26 deletions data/txHandler.go
Expand Up @@ -275,32 +275,6 @@ func (handler *TxHandler) checkAlreadyCommitted(tx *txBacklogMsg) (processingDon
tx.spec.FeeSink = latestHdr.FeeSink
tx.spec.RewardsPool = latestHdr.RewardsPool

tc := transactions.ExplicitTxnContext{
ExplicitRound: latest + 1,
Proto: tx.proto,
GenID: handler.genesisID,
GenHash: handler.genesisHash,
}

for _, txn := range tx.unverifiedTxGroup {
err = txn.Txn.Alive(tc)
if err != nil {
logging.Base().Debugf("Received a dead txn %s: %v", txn.ID(), err)
return true
}

committed, err := handler.ledger.Committed(tx.proto, txn)
if err != nil {
logging.Base().Errorf("Could not verify committed status of txn %v: %v", txn, err)
return true
}

if committed {
logging.Base().Debugf("Already confirmed tx %v", txn.ID())
return true
}
}

return false
}

Expand Down
10 changes: 0 additions & 10 deletions ledger/ledger.go
Expand Up @@ -356,16 +356,6 @@ func (l *Ledger) LatestCommitted() basics.Round {
return l.blockQ.latestCommitted()
}

// Committed uses the transaction tail tracker to check if txn already
// appeared in a block.
func (l *Ledger) Committed(currentProto config.ConsensusParams, txn transactions.SignedTxn) (bool, error) {
l.trackerMu.RLock()
defer l.trackerMu.RUnlock()
// do not check for whether lease would excluded this
txl := txlease{sender: txn.Txn.Sender}
return l.txTail.isDup(currentProto, l.Latest()+1, txn.Txn.First(), txn.Txn.Last(), txn.ID(), txl)
}

func (l *Ledger) blockAux(rnd basics.Round) (bookkeeping.Block, evalAux, error) {
return l.blockQ.getBlockAux(rnd)
}
Expand Down

0 comments on commit 1222702

Please sign in to comment.