mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 13:41:37 +00:00
mempool: don't sort items by hash
There is nothing requiring us to do so. It also is bad because it allows for new transaction to replace some already existing one with the same fee parameters just because it has "better" hash. But the other thing is that for transactions with equal fees it's always better for us to append them to the end of the list, instead of inserting them in the middle, so this change allows to reduce slice item movements and gain some 6-7% increase for single-node TPS.
This commit is contained in:
parent
5df726db68
commit
9591d64e53
1 changed files with 1 additions and 6 deletions
|
@ -76,12 +76,7 @@ func (p item) CompareTo(otherP item) int {
|
|||
return ret
|
||||
}
|
||||
|
||||
if ret := int(p.txn.NetworkFee - otherP.txn.NetworkFee); ret != 0 {
|
||||
return ret
|
||||
}
|
||||
|
||||
// Transaction hash sorted descending.
|
||||
return otherP.txn.Hash().CompareTo(p.txn.Hash())
|
||||
return int(p.txn.NetworkFee - otherP.txn.NetworkFee)
|
||||
}
|
||||
|
||||
// Count returns the total number of uncofirm transactions.
|
||||
|
|
Loading…
Reference in a new issue