diff --git a/go/enclave/components/batch_registry.go b/go/enclave/components/batch_registry.go index bcbdfc43dc..ad2200dbf2 100644 --- a/go/enclave/components/batch_registry.go +++ b/go/enclave/components/batch_registry.go @@ -177,10 +177,8 @@ func (br *batchRegistry) GetBatchAtHeight(height gethrpc.BlockNumber) (*core.Bat return nil, fmt.Errorf("could not retrieve genesis rollup. Cause: %w", err) } batch = genesisBatch - case gethrpc.PendingBlockNumber: - // todo - depends on the current pending rollup; leaving it for a different iteration as it will need more thought - return nil, fmt.Errorf("requested balance for pending block. This is not handled currently") - case gethrpc.SafeBlockNumber, gethrpc.FinalizedBlockNumber, gethrpc.LatestBlockNumber: + // note: our API currently treats all these block statuses the same for obscuro batches + case gethrpc.SafeBlockNumber, gethrpc.FinalizedBlockNumber, gethrpc.LatestBlockNumber, gethrpc.PendingBlockNumber: headBatch, err := br.storage.FetchBatchBySeqNo(br.headBatchSeq.Uint64()) if err != nil { return nil, fmt.Errorf("batch with requested height %d was not found. Cause: %w", height, err) diff --git a/go/host/rpc/clientapi/client_api_eth.go b/go/host/rpc/clientapi/client_api_eth.go index 92c24bfde1..423a15cb13 100644 --- a/go/host/rpc/clientapi/client_api_eth.go +++ b/go/host/rpc/clientapi/client_api_eth.go @@ -9,7 +9,6 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/rpc" "github.com/obscuronet/go-obscuro/go/common" - "github.com/obscuronet/go-obscuro/go/common/errutil" "github.com/obscuronet/go-obscuro/go/common/host" "github.com/obscuronet/go-obscuro/go/common/log" "github.com/obscuronet/go-obscuro/go/responses" @@ -207,7 +206,9 @@ type FeeHistoryResult struct { // Given a batch number, returns the hash of the batch with that number. func (api *EthereumAPI) batchNumberToBatchHash(batchNumber rpc.BlockNumber) (*gethcommon.Hash, error) { // Handling the special cases first. No special handling is required for rpc.EarliestBlockNumber. - if batchNumber == rpc.LatestBlockNumber { + // note: our API currently treats all these block statuses the same for obscuro batches + if batchNumber == rpc.LatestBlockNumber || batchNumber == rpc.PendingBlockNumber || + batchNumber == rpc.FinalizedBlockNumber || batchNumber == rpc.SafeBlockNumber { batchHeader, err := api.host.DB().GetHeadBatchHeader() if err != nil { return nil, err @@ -216,10 +217,6 @@ func (api *EthereumAPI) batchNumberToBatchHash(batchNumber rpc.BlockNumber) (*ge return &batchHash, nil } - if batchNumber == rpc.PendingBlockNumber { - return nil, errutil.ErrNoImpl - } - batchNumberBig := big.NewInt(batchNumber.Int64()) batchHash, err := api.host.DB().GetBatchHash(batchNumberBig) if err != nil {