mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-28 08:11:08 +00:00
Orphan maps should be idToOrphan
This commit is contained in:
parent
01edc43e36
commit
17357a0fca
@ -8,10 +8,10 @@ import (
|
||||
type idToTransaction map[externalapi.DomainTransactionID]*mempoolTransaction
|
||||
|
||||
type mempoolTransaction struct {
|
||||
transaction *externalapi.DomainTransaction
|
||||
parentsInPool idToTransaction
|
||||
isHighPriority bool
|
||||
addAtDAAScore uint64
|
||||
transaction *externalapi.DomainTransaction
|
||||
parentsInPool idToTransaction
|
||||
isHighPriority bool
|
||||
addedAtDAAScore uint64
|
||||
}
|
||||
|
||||
func (mt *mempoolTransaction) transactionID() *externalapi.DomainTransactionID {
|
||||
|
||||
@ -2,11 +2,12 @@ package mempool
|
||||
|
||||
import "github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
|
||||
|
||||
type previousOutpointToOrphans map[externalapi.DomainOutpoint]idToTransaction
|
||||
type idToOrphan map[externalapi.DomainTransactionID]*orphanTransaction
|
||||
type previousOutpointToOrphans map[externalapi.DomainOutpoint]idToOrphan
|
||||
|
||||
type orphansPool struct {
|
||||
mempool *mempool
|
||||
allOrphans idToTransaction
|
||||
allOrphans idToOrphan
|
||||
orphanByPreviousOutpoint previousOutpointToOrphans
|
||||
lastExpireScan uint64
|
||||
}
|
||||
@ -14,7 +15,7 @@ type orphansPool struct {
|
||||
func newOrphansPool(mp *mempool) *orphansPool {
|
||||
return &orphansPool{
|
||||
mempool: mp,
|
||||
allOrphans: idToTransaction{},
|
||||
allOrphans: idToOrphan{},
|
||||
orphanByPreviousOutpoint: previousOutpointToOrphans{},
|
||||
lastExpireScan: 0,
|
||||
}
|
||||
@ -57,7 +58,7 @@ func (op *orphansPool) expireOrphanTransactions() error {
|
||||
}
|
||||
|
||||
// Remove all transactions whose addedAtDAAScore is older then transactionExpireIntervalDAAScore
|
||||
if virtualDAAScore-orphanTransaction.addAtDAAScore > op.mempool.config.orphanExpireIntervalDAAScore {
|
||||
if virtualDAAScore-orphanTransaction.addedAtDAAScore > op.mempool.config.orphanExpireIntervalDAAScore {
|
||||
err = op.removeOrphan(orphanTransaction.transactionID())
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@ -51,7 +51,7 @@ func (tp *transactionsPool) expireOldTransactions() error {
|
||||
}
|
||||
|
||||
// Remove all transactions whose addedAtDAAScore is older then transactionExpireIntervalDAAScore
|
||||
if virtualDAAScore-mempoolTransaction.addAtDAAScore > tp.mempool.config.transactionExpireIntervalDAAScore {
|
||||
if virtualDAAScore-mempoolTransaction.addedAtDAAScore > tp.mempool.config.transactionExpireIntervalDAAScore {
|
||||
err = tp.mempool.RemoveTransaction(mempoolTransaction.transactionID())
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user