From 330e1670d683f630f767877d328f73d64a1d6529 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 13 Jul 2020 18:07:02 +0300 Subject: [PATCH] consensus: limit payload verification time with GAS Follow C# implementation. --- pkg/consensus/payload.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/consensus/payload.go b/pkg/consensus/payload.go index 80f56f0f7..5bfde2a75 100644 --- a/pkg/consensus/payload.go +++ b/pkg/consensus/payload.go @@ -49,6 +49,8 @@ const ( commitType messageType = 0x30 recoveryRequestType messageType = 0x40 recoveryMessageType messageType = 0x41 + + payloadGasLimit = 2000000 // 0.02 GAS ) // ViewNumber implements payload.ConsensusPayload interface. @@ -221,6 +223,7 @@ func (p *Payload) Verify(scriptHash util.Uint160) bool { } v := vm.New() + v.GasLimit = payloadGasLimit v.RegisterInteropGetter(crypto.GetInterop(&interop.Context{Container: p})) v.LoadScript(verification) v.LoadScript(p.Witness.InvocationScript)