forked from TrueCloudLab/neoneo-go
consensus: switch test to using the new PoolTx API
Fixes GolangCI: Error return value of (*github.com/CityOfZion/neo-go/pkg/core/mempool.Pool).Add is not checked (from errcheck) and allows us to almost completely forget about mempool here.
This commit is contained in:
parent
18695e660b
commit
7445655437
1 changed files with 4 additions and 6 deletions
|
@ -21,7 +21,7 @@ func TestNewService(t *testing.T) {
|
||||||
Type: transaction.MinerType,
|
Type: transaction.MinerType,
|
||||||
Data: &transaction.MinerTX{Nonce: 12345},
|
Data: &transaction.MinerTX{Nonce: 12345},
|
||||||
}
|
}
|
||||||
srv.Chain.GetMemPool().Add(tx, new(feer))
|
require.NoError(t, srv.Chain.PoolTx(tx))
|
||||||
|
|
||||||
var txx []block.Transaction
|
var txx []block.Transaction
|
||||||
require.NotPanics(t, func() { txx = srv.getVerifiedTx(1) })
|
require.NotPanics(t, func() { txx = srv.getVerifiedTx(1) })
|
||||||
|
@ -38,9 +38,7 @@ func TestService_GetVerified(t *testing.T) {
|
||||||
newMinerTx(3),
|
newMinerTx(3),
|
||||||
newMinerTx(4),
|
newMinerTx(4),
|
||||||
}
|
}
|
||||||
pool := srv.Chain.GetMemPool()
|
require.NoError(t, srv.Chain.PoolTx(txs[3]))
|
||||||
|
|
||||||
require.NoError(t, pool.Add(txs[3], new(feer)))
|
|
||||||
|
|
||||||
hashes := []util.Uint256{txs[0].Hash(), txs[1].Hash(), txs[2].Hash()}
|
hashes := []util.Uint256{txs[0].Hash(), txs[1].Hash(), txs[2].Hash()}
|
||||||
|
|
||||||
|
@ -65,7 +63,7 @@ func TestService_GetVerified(t *testing.T) {
|
||||||
|
|
||||||
t.Run("more than half of the last proposal will be reused", func(t *testing.T) {
|
t.Run("more than half of the last proposal will be reused", func(t *testing.T) {
|
||||||
for _, tx := range txs[:2] {
|
for _, tx := range txs[:2] {
|
||||||
require.NoError(t, pool.Add(tx, new(feer)))
|
require.NoError(t, srv.Chain.PoolTx(tx))
|
||||||
}
|
}
|
||||||
|
|
||||||
txx := srv.getVerifiedTx(10)
|
txx := srv.getVerifiedTx(10)
|
||||||
|
@ -115,7 +113,7 @@ func TestService_getTx(t *testing.T) {
|
||||||
|
|
||||||
require.Equal(t, nil, srv.getTx(h))
|
require.Equal(t, nil, srv.getTx(h))
|
||||||
|
|
||||||
srv.Chain.GetMemPool().Add(tx, new(feer))
|
require.NoError(t, srv.Chain.PoolTx(tx))
|
||||||
|
|
||||||
got := srv.getTx(h)
|
got := srv.getTx(h)
|
||||||
require.NotNil(t, got)
|
require.NotNil(t, got)
|
||||||
|
|
Loading…
Reference in a new issue