mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
Fixed pending block response (#8200)
This commit is contained in:
parent
9c47978472
commit
1f77fee04a
@ -96,10 +96,19 @@ func (s *EthBackendServer) Version(context.Context, *emptypb.Empty) (*types2.Ver
|
||||
return EthBackendAPIVersion, nil
|
||||
}
|
||||
|
||||
func (s *EthBackendServer) PendingBlock(_ context.Context, _ *emptypb.Empty) (*remote.PendingBlockReply, error) {
|
||||
func (s *EthBackendServer) PendingBlock(ctx context.Context, _ *emptypb.Empty) (*remote.PendingBlockReply, error) {
|
||||
pendingBlock := s.latestBlockBuiltStore.BlockBuilt()
|
||||
if pendingBlock == nil {
|
||||
return nil, nil
|
||||
tx, err := s.db.BeginRo(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
// use latest
|
||||
pendingBlock, err = s.blockReader.CurrentBlock(tx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
blockRlp, err := rlp.EncodeToBytes(pendingBlock)
|
||||
|
Loading…
Reference in New Issue
Block a user