mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
parent
7a64fe44eb
commit
c12d298f1c
@ -71,6 +71,7 @@ type BlockNumber int64
|
|||||||
type Timestamp uint64
|
type Timestamp uint64
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
LatestExecutedBlockNumber = BlockNumber(-5)
|
||||||
FinalizedBlockNumber = BlockNumber(-4)
|
FinalizedBlockNumber = BlockNumber(-4)
|
||||||
SafeBlockNumber = BlockNumber(-3)
|
SafeBlockNumber = BlockNumber(-3)
|
||||||
PendingBlockNumber = BlockNumber(-2)
|
PendingBlockNumber = BlockNumber(-2)
|
||||||
@ -106,6 +107,8 @@ func (bn *BlockNumber) UnmarshalJSON(data []byte) error {
|
|||||||
case "finalized":
|
case "finalized":
|
||||||
*bn = FinalizedBlockNumber
|
*bn = FinalizedBlockNumber
|
||||||
return nil
|
return nil
|
||||||
|
case "latestExecuted":
|
||||||
|
*bn = LatestExecutedBlockNumber
|
||||||
case "null":
|
case "null":
|
||||||
*bn = LatestBlockNumber
|
*bn = LatestBlockNumber
|
||||||
return nil
|
return nil
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/ledgerwatch/erigon/eth/stagedsync/stages"
|
"github.com/ledgerwatch/erigon/eth/stagedsync/stages"
|
||||||
"github.com/ledgerwatch/erigon/rpc"
|
"github.com/ledgerwatch/erigon/rpc"
|
||||||
"github.com/ledgerwatch/erigon/turbo/adapter"
|
"github.com/ledgerwatch/erigon/turbo/adapter"
|
||||||
|
"github.com/ledgerwatch/log/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// unable to decode supplied params, or an invalid number of parameters
|
// unable to decode supplied params, or an invalid number of parameters
|
||||||
@ -63,10 +64,13 @@ func _GetBlockNumber(requireCanonical bool, blockNrOrHash rpc.BlockNumberOrHash,
|
|||||||
case rpc.PendingBlockNumber:
|
case rpc.PendingBlockNumber:
|
||||||
pendingBlock := filters.LastPendingBlock()
|
pendingBlock := filters.LastPendingBlock()
|
||||||
if pendingBlock == nil {
|
if pendingBlock == nil {
|
||||||
|
log.Warn("no pending block found returning latest executed block")
|
||||||
blockNumber = plainStateBlockNumber
|
blockNumber = plainStateBlockNumber
|
||||||
} else {
|
} else {
|
||||||
return pendingBlock.NumberU64(), pendingBlock.Hash(), false, nil
|
return pendingBlock.NumberU64(), pendingBlock.Hash(), false, nil
|
||||||
}
|
}
|
||||||
|
case rpc.LatestExecutedBlockNumber:
|
||||||
|
blockNumber = plainStateBlockNumber
|
||||||
default:
|
default:
|
||||||
blockNumber = uint64(number.Int64())
|
blockNumber = uint64(number.Int64())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user