From 4ca57ab76cbdb4699ffc5be31aae6de00ca23bd0 Mon Sep 17 00:00:00 2001 From: xiyang <161114931+0xdoomxy@users.noreply.github.com> Date: Tue, 3 Dec 2024 10:47:46 +0800 Subject: [PATCH] Compensate for the inability to capture panic caused by register --- eth/catalyst/api.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index fa9752734e..8bf9b7cf5f 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -46,6 +46,11 @@ import ( // Register adds the engine API to the full node. func Register(stack *node.Node, backend *eth.Ethereum) error { log.Warn("Engine API enabled", "protocol", "eth") + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("panic %v when register consensus api", r) + } + }() stack.RegisterAPIs([]rpc.API{ { Namespace: "engine",