forked from TrueCloudLab/neoneo-go
consensus: limit payload verification time with GAS
Follow C# implementation.
This commit is contained in:
parent
3134e364b2
commit
330e1670d6
1 changed files with 3 additions and 0 deletions
|
@ -49,6 +49,8 @@ const (
|
||||||
commitType messageType = 0x30
|
commitType messageType = 0x30
|
||||||
recoveryRequestType messageType = 0x40
|
recoveryRequestType messageType = 0x40
|
||||||
recoveryMessageType messageType = 0x41
|
recoveryMessageType messageType = 0x41
|
||||||
|
|
||||||
|
payloadGasLimit = 2000000 // 0.02 GAS
|
||||||
)
|
)
|
||||||
|
|
||||||
// ViewNumber implements payload.ConsensusPayload interface.
|
// ViewNumber implements payload.ConsensusPayload interface.
|
||||||
|
@ -221,6 +223,7 @@ func (p *Payload) Verify(scriptHash util.Uint160) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
v := vm.New()
|
v := vm.New()
|
||||||
|
v.GasLimit = payloadGasLimit
|
||||||
v.RegisterInteropGetter(crypto.GetInterop(&interop.Context{Container: p}))
|
v.RegisterInteropGetter(crypto.GetInterop(&interop.Context{Container: p}))
|
||||||
v.LoadScript(verification)
|
v.LoadScript(verification)
|
||||||
v.LoadScript(p.Witness.InvocationScript)
|
v.LoadScript(p.Witness.InvocationScript)
|
||||||
|
|
Loading…
Reference in a new issue