From dd187275b7507d0dd186f55190be271b9a2e4259 Mon Sep 17 00:00:00 2001 From: gokch Date: Thu, 1 Feb 2024 08:40:51 +0000 Subject: [PATCH] handle timeout in delegatecall --- contract/vm_callback.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contract/vm_callback.go b/contract/vm_callback.go index 86feaeda1..b46e38e3b 100644 --- a/contract/vm_callback.go +++ b/contract/vm_callback.go @@ -399,7 +399,12 @@ func luaDelegateCallContract(L *LState, service C.int, contractId *C.char, if ctx.traceFile != nil { _, _ = ctx.traceFile.WriteString(fmt.Sprintf("recovery snapshot: %d\n", seq)) } - return -1, C.CString("[Contract.LuaDelegateCallContract] call error: " + ce.err.Error()) + switch ceErr := ce.err.(type) { + case *VmTimeoutError: + return -1, C.CString(ceErr.Error()) + default: + return -1, C.CString("[Contract.LuaDelegateCallContract] call error: " + ce.err.Error()) + } } if seq == 1 {