Add CatchableErrors where needed because of db backends used

In nim-eth this will not fail, as they are base, not implemented
methods. In for example Nimbus-eth1 it will.
This commit is contained in:
kdeme 2021-05-07 16:28:35 +02:00
parent 90b4724492
commit bcb58216d1
No known key found for this signature in database
GPG Key ID: 4E8DD21420AF43F5
2 changed files with 5 additions and 5 deletions

View File

@ -373,7 +373,7 @@ method genesisHash*(db: AbstractChainDB): KeccakHash
notImplemented()
method getBlockHeader*(db: AbstractChainDB, b: HashOrNum,
output: var BlockHeader): bool {.base, gcsafe, raises: [Defect].} =
output: var BlockHeader): bool {.base, gcsafe, raises: [CatchableError, Defect].} =
notImplemented()
proc getBlockHeader*(db: AbstractChainDB, hash: KeccakHash): BlockHeaderRef {.gcsafe.} =
@ -387,17 +387,17 @@ proc getBlockHeader*(db: AbstractChainDB, b: BlockNumber): BlockHeaderRef {.gcsa
return nil
method getBestBlockHeader*(self: AbstractChainDB): BlockHeader
{.base, gcsafe, raises: [Defect].} =
{.base, gcsafe, raises: [CatchableError, Defect].} =
notImplemented()
method getSuccessorHeader*(db: AbstractChainDB, h: BlockHeader,
output: var BlockHeader, skip = 0'u): bool
{.base, gcsafe, raises: [Defect].} =
{.base, gcsafe, raises: [CatchableError, Defect].} =
notImplemented()
method getAncestorHeader*(db: AbstractChainDB, h: BlockHeader,
output: var BlockHeader, skip = 0'u): bool
{.base, gcsafe, raises: [Defect].} =
{.base, gcsafe, raises: [CatchableError, Defect].} =
notImplemented()
method getBlockBody*(db: AbstractChainDB, blockHash: KeccakHash): BlockBodyRef

View File

@ -4,7 +4,7 @@ import
# TODO: Perhaps we can move this to eth-common
proc getBlockHeaders*(db: AbstractChainDB, req: BlocksRequest): seq[BlockHeader]
{.gcsafe, raises: [Defect].} =
{.gcsafe, raises: [CatchableError, Defect].} =
result = newSeqOfCap[BlockHeader](req.maxResults)
var foundBlock: BlockHeader