consensus: fix payload sign test

Do not fill verification script randomly as there is a probability
for it to be executed sucessfully.

time="2019-12-12T17:24:22+03:00" level=info msg="blockchain persist completed" blockHeight=0 headerHeight=0 persistedBlocks=0 persistedKeys=15 took="54.474µs"
time="2019-12-12T17:24:23+03:00" level=info msg="blockchain persist completed" blockHeight=0 headerHeight=0 persistedBlocks=0 persistedKeys=15 took="49.312µs"
2019-12-12T17:24:24.026+0300    DEBUG   can't verify payload from #%d1  {"module": "dbft"}
--- FAIL: TestPayload_Sign (0.00s)
    payload_test.go:302:
                Error Trace:    payload_test.go:302
                Error:          Should be false
                Test:           TestPayload_Sign
FAIL
coverage: 75.8% of statements
FAIL    github.com/CityOfZion/neo-go/pkg/consensus      2.145s
This commit is contained in:
Evgenii Stratonikov 2019-12-12 17:38:03 +03:00
parent 170d020081
commit 0efd9a6062

View file

@ -11,6 +11,7 @@ import (
"github.com/CityOfZion/neo-go/pkg/crypto/keys"
"github.com/CityOfZion/neo-go/pkg/io"
"github.com/CityOfZion/neo-go/pkg/util"
"github.com/CityOfZion/neo-go/pkg/vm/opcode"
"github.com/nspcc-dev/dbft/payload"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -198,7 +199,7 @@ func randomPayload(t *testing.T, mt messageType) *Payload {
timestamp: rand.Uint32(),
Witness: transaction.Witness{
InvocationScript: fillRandom(t, make([]byte, 3)),
VerificationScript: fillRandom(t, make([]byte, 4)),
VerificationScript: []byte{byte(opcode.PUSH0)},
},
}
fillRandom(t, p.prevHash[:])