mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
modified GetBlockByNumber and GetBlockByHash function to call getHeaderWithAuthor function
This commit is contained in:
parent
b9d1869d95
commit
b3c02842b9
1 changed files with 6 additions and 0 deletions
|
|
@ -834,6 +834,9 @@ func (s *PublicBlockChainAPI) getHeaderWithAuthor(head *types.Header) error {
|
|||
func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error) {
|
||||
block, err := s.b.BlockByNumber(ctx, number)
|
||||
if block != nil && err == nil {
|
||||
if err = s.getHeaderWithAuthor(block.Header()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response, err := s.rpcMarshalBlock(ctx, block, true, fullTx)
|
||||
if err == nil && number == rpc.PendingBlockNumber {
|
||||
// Pending blocks need to nil out a few fields
|
||||
|
|
@ -857,6 +860,9 @@ func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.B
|
|||
func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error) {
|
||||
block, err := s.b.BlockByHash(ctx, hash)
|
||||
if block != nil {
|
||||
if err = s.getHeaderWithAuthor(block.Header()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response, err := s.rpcMarshalBlock(ctx, block, true, fullTx)
|
||||
// append marshalled bor transaction
|
||||
if err == nil && response != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue