Skip to content

Commit

Permalink
update rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
blxdyx committed Aug 23, 2024
1 parent 17729fb commit b120532
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
22 changes: 9 additions & 13 deletions turbo/jsonrpc/bsc_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,11 @@ func (api *BscImpl) GetBlobSidecars(ctx context.Context, numberOrHash rpc.BlockN
return nil, err
}
defer tx.Rollback()

blockNumber, blockHash, _, err := rpchelper.GetBlockNumber(numberOrHash, tx, api.ethApi.filters)
if err != nil {
return nil, err
}

bsc, err := api.parlia()
blockNumber, _, _, err := rpchelper.GetBlockNumber(numberOrHash, tx, api.ethApi.filters)
if err != nil {
return nil, err
}
blobSidecars, found, err := bsc.BlobStore.ReadBlobSidecars(ctx, blockNumber, blockHash)
blobSidecars, found, err := api.ethApi._blockReader.ReadBlobByNumber(ctx, tx, blockNumber)
if err != nil || !found {
return nil, err
}
Expand All @@ -249,18 +243,20 @@ func (api *BscImpl) GetBlobSidecars(ctx context.Context, numberOrHash rpc.BlockN
}

func (api *BscImpl) GetBlobSidecarByTxHash(ctx context.Context, hash libcommon.Hash) (map[string]interface{}, error) {
roTx, err := api.ethApi.db.BeginRo(ctx)
if err != nil {
return nil, err
}
defer roTx.Rollback()
tx, err := api.ethApi.GetTransactionByHash(ctx, hash)
if err != nil {
return nil, err
}
if tx == nil || tx.BlockNumber == nil || tx.BlockHash == nil || tx.TransactionIndex == nil {
return nil, nil
}
bsc, err := api.parlia()
if err != nil {
return nil, err
}
blobSidecars, found, err := bsc.BlobStore.ReadBlobSidecars(ctx, tx.BlockNumber.Uint64(), *tx.BlockHash)

blobSidecars, found, err := api.ethApi._blockReader.ReadBlobByNumber(ctx, roTx, tx.BlockNumber.Uint64())
if err != nil || !found {
return nil, err
}
Expand Down
3 changes: 0 additions & 3 deletions turbo/jsonrpc/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ func APIList(db kv.RoDB, eth rpchelper.ApiBackend, txPool txpool.TxpoolClient, m
case *bor.Bor:
borImpl = NewBorAPI(base, db)
case lazy:
if _, ok := engine.Engine().(*parlia.Parlia); !engine.HasEngine() || ok {
bscImpl = NewBscAPI(ethImpl)
}
if _, ok := engine.Engine().(*bor.Bor); !engine.HasEngine() || ok {
borImpl = NewBorAPI(base, db)
}
Expand Down

0 comments on commit b120532

Please sign in to comment.