forked from cerc-io/plugeth
core, eth, les, rpc: polish catalyst errors, add context
This commit is contained in:
+3
-3
@@ -98,7 +98,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV1(heads beacon.ForkchoiceStateV1, pay
|
||||
|
||||
// GetPayloadV1 returns a cached payload by id. It's not supported in les mode.
|
||||
func (api *ConsensusAPI) GetPayloadV1(payloadID beacon.PayloadID) (*beacon.ExecutableDataV1, error) {
|
||||
return nil, &beacon.GenericServerError
|
||||
return nil, beacon.GenericServerError.With(errors.New("not supported in light client mode"))
|
||||
}
|
||||
|
||||
// ExecutePayloadV1 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
|
||||
@@ -157,7 +157,7 @@ func (api *ConsensusAPI) checkTerminalTotalDifficulty(head common.Hash) error {
|
||||
// make sure the parent has enough terminal total difficulty
|
||||
header := api.les.BlockChain().GetHeaderByHash(head)
|
||||
if header == nil {
|
||||
return &beacon.GenericServerError
|
||||
return errors.New("unknown header")
|
||||
}
|
||||
td := api.les.BlockChain().GetTd(header.Hash(), header.Number.Uint64())
|
||||
if td != nil && td.Cmp(api.les.BlockChain().Config().TerminalTotalDifficulty) < 0 {
|
||||
@@ -176,7 +176,7 @@ func (api *ConsensusAPI) setCanonical(newHead common.Hash) error {
|
||||
}
|
||||
newHeadHeader := api.les.BlockChain().GetHeaderByHash(newHead)
|
||||
if newHeadHeader == nil {
|
||||
return &beacon.GenericServerError
|
||||
return errors.New("unknown header")
|
||||
}
|
||||
if err := api.les.BlockChain().SetCanonical(newHeadHeader); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user