forked from TrueCloudLab/neoneo-go
core: fix ineffassign warning in test code
ineffectual assignment to err (ineffassign)
This commit is contained in:
parent
ec50bb4041
commit
4cd3da99b4
3 changed files with 5 additions and 2 deletions
|
@ -238,6 +238,7 @@ func TestGetBlock(t *testing.T) {
|
||||||
t.Run("non-empty block", func(t *testing.T) {
|
t.Run("non-empty block", func(t *testing.T) {
|
||||||
tx, err := testchain.NewTransferFromOwner(bc, bc.contracts.NEO.Hash,
|
tx, err := testchain.NewTransferFromOwner(bc, bc.contracts.NEO.Hash,
|
||||||
random.Uint160(), 1, 1, 1000)
|
random.Uint160(), 1, 1, 1000)
|
||||||
|
require.NoError(t, err)
|
||||||
b := bc.newBlock(tx)
|
b := bc.newBlock(tx)
|
||||||
require.NoError(t, bc.AddHeaders(&b.Header))
|
require.NoError(t, bc.AddHeaders(&b.Header))
|
||||||
|
|
||||||
|
|
|
@ -130,10 +130,10 @@ func TestDesignate_DesignateAsRole(t *testing.T) {
|
||||||
ic.SpawnVM()
|
ic.SpawnVM()
|
||||||
ic.VM.LoadScript([]byte{byte(opcode.RET)})
|
ic.VM.LoadScript([]byte{byte(opcode.RET)})
|
||||||
|
|
||||||
pubs, index, err := des.GetDesignatedByRole(bc.dao, 0xFF, 255)
|
_, _, err := des.GetDesignatedByRole(bc.dao, 0xFF, 255)
|
||||||
require.True(t, errors.Is(err, native.ErrInvalidRole), "got: %v", err)
|
require.True(t, errors.Is(err, native.ErrInvalidRole), "got: %v", err)
|
||||||
|
|
||||||
pubs, index, err = des.GetDesignatedByRole(bc.dao, noderoles.Oracle, 255)
|
pubs, index, err := des.GetDesignatedByRole(bc.dao, noderoles.Oracle, 255)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, 0, len(pubs))
|
require.Equal(t, 0, len(pubs))
|
||||||
require.Equal(t, uint32(0), index)
|
require.Equal(t, uint32(0), index)
|
||||||
|
|
|
@ -215,6 +215,7 @@ func TestStateRootFull(t *testing.T) {
|
||||||
require.Eventually(t, func() bool { return lastHeight.Load() == 2 }, time.Second, time.Millisecond)
|
require.Eventually(t, func() bool { return lastHeight.Load() == 2 }, time.Second, time.Millisecond)
|
||||||
checkVoteBroadcasted(t, bc, lastValidated.Load().(*payload.Extensible), 2, 1)
|
checkVoteBroadcasted(t, bc, lastValidated.Load().(*payload.Extensible), 2, 1)
|
||||||
_, err = persistBlock(bc)
|
_, err = persistBlock(bc)
|
||||||
|
require.NoError(t, err)
|
||||||
require.Eventually(t, func() bool { return lastHeight.Load() == 3 }, time.Second, time.Millisecond)
|
require.Eventually(t, func() bool { return lastHeight.Load() == 3 }, time.Second, time.Millisecond)
|
||||||
checkVoteBroadcasted(t, bc, lastValidated.Load().(*payload.Extensible), 3, 1)
|
checkVoteBroadcasted(t, bc, lastValidated.Load().(*payload.Extensible), 3, 1)
|
||||||
|
|
||||||
|
@ -257,6 +258,7 @@ func checkVoteBroadcasted(t *testing.T, bc *Blockchain, p *payload.Extensible,
|
||||||
require.Equal(t, int32(valIndex), vote.ValidatorIndex)
|
require.Equal(t, int32(valIndex), vote.ValidatorIndex)
|
||||||
|
|
||||||
pubs, _, err := bc.contracts.Designate.GetDesignatedByRole(bc.dao, noderoles.StateValidator, bc.BlockHeight())
|
pubs, _, err := bc.contracts.Designate.GetDesignatedByRole(bc.dao, noderoles.StateValidator, bc.BlockHeight())
|
||||||
|
require.NoError(t, err)
|
||||||
require.True(t, len(pubs) > int(valIndex))
|
require.True(t, len(pubs) > int(valIndex))
|
||||||
require.True(t, pubs[valIndex].VerifyHashable(vote.Signature, uint32(netmode.UnitTestNet), r))
|
require.True(t, pubs[valIndex].VerifyHashable(vote.Signature, uint32(netmode.UnitTestNet), r))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue