Compensate for the inability to capture panic caused by register

This commit is contained in:
xiyang 2024-12-03 10:47:46 +08:00 committed by GitHub
parent ae5a16f870
commit 4ca57ab76c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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",