mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-05 03:58:23 +00:00
parent
0333107327
commit
66a64dd4c9
2 changed files with 4 additions and 1 deletions
|
@ -180,7 +180,6 @@ func (mp *Pool) Add(t *transaction.Transaction, fee Feer) error {
|
||||||
return ErrDup
|
return ErrDup
|
||||||
}
|
}
|
||||||
|
|
||||||
mp.verifiedMap[t.Hash()] = pItem
|
|
||||||
// Insert into sorted array (from max to min, that could also be done
|
// Insert into sorted array (from max to min, that could also be done
|
||||||
// using sort.Sort(sort.Reverse()), but it incurs more overhead. Notice
|
// using sort.Sort(sort.Reverse()), but it incurs more overhead. Notice
|
||||||
// also that we're searching for position that is strictly more
|
// also that we're searching for position that is strictly more
|
||||||
|
@ -209,6 +208,7 @@ func (mp *Pool) Add(t *transaction.Transaction, fee Feer) error {
|
||||||
copy(mp.verifiedTxes[n+1:], mp.verifiedTxes[n:])
|
copy(mp.verifiedTxes[n+1:], mp.verifiedTxes[n:])
|
||||||
mp.verifiedTxes[n] = pItem
|
mp.verifiedTxes[n] = pItem
|
||||||
}
|
}
|
||||||
|
mp.verifiedMap[t.Hash()] = pItem
|
||||||
|
|
||||||
// For lots of inputs it might be easier to push them all and sort
|
// For lots of inputs it might be easier to push them all and sort
|
||||||
// afterwards, but that requires benchmarking.
|
// afterwards, but that requires benchmarking.
|
||||||
|
|
|
@ -303,6 +303,9 @@ func TestOverCapacity(t *testing.T) {
|
||||||
txcnt++
|
txcnt++
|
||||||
require.Error(t, mp.Add(tx, fs))
|
require.Error(t, mp.Add(tx, fs))
|
||||||
require.Equal(t, mempoolSize, mp.Count())
|
require.Equal(t, mempoolSize, mp.Count())
|
||||||
|
require.Equal(t, mempoolSize, len(mp.verifiedMap))
|
||||||
|
require.Equal(t, mempoolSize, len(mp.verifiedTxes))
|
||||||
|
require.False(t, mp.containsKey(tx.Hash()))
|
||||||
require.Equal(t, true, sort.IsSorted(sort.Reverse(mp.verifiedTxes)))
|
require.Equal(t, true, sort.IsSorted(sort.Reverse(mp.verifiedTxes)))
|
||||||
|
|
||||||
// But claim tx should still be there.
|
// But claim tx should still be there.
|
||||||
|
|
Loading…
Reference in a new issue