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