From 0efd9a60623f327067d192c55f21249d9c815b6b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 12 Dec 2019 17:38:03 +0300 Subject: [PATCH] consensus: fix payload sign test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkg/consensus/payload_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/consensus/payload_test.go b/pkg/consensus/payload_test.go index 26c2c4b42..f61391e73 100644 --- a/pkg/consensus/payload_test.go +++ b/pkg/consensus/payload_test.go @@ -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[:])