mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-04 19:19:44 +00:00
parent
8e785feeb6
commit
6437f4b32e
1 changed files with 6 additions and 5 deletions
|
@ -1528,12 +1528,13 @@ func (bc *Blockchain) ApplyPolicyToTxSet(txes []mempool.TxWithFee) []mempool.TxW
|
|||
txes = txes[:bc.config.MaxTransactionsPerBlock]
|
||||
}
|
||||
maxFree := bc.config.MaxFreeTransactionsPerBlock
|
||||
if maxFree != 0 {
|
||||
lowStart := sort.Search(len(txes), func(i int) bool {
|
||||
return bc.IsLowPriority(txes[i].Fee)
|
||||
if maxFree != 0 && len(txes) > maxFree {
|
||||
// Transactions are sorted by fee, so we just find the first free one.
|
||||
freeStart := sort.Search(len(txes), func(i int) bool {
|
||||
return txes[i].Fee == 0
|
||||
})
|
||||
if lowStart+maxFree < len(txes) {
|
||||
txes = txes[:lowStart+maxFree]
|
||||
if freeStart+maxFree < len(txes) {
|
||||
txes = txes[:freeStart+maxFree]
|
||||
}
|
||||
}
|
||||
return txes
|
||||
|
|
Loading…
Reference in a new issue