Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Adding correct miner address on API at the RPC level (POS-553)" #631

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -819,20 +819,6 @@ func (s *PublicBlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.H
return nil
}

// getAuthor: returns the author of the Block
func (s *PublicBlockChainAPI) getAuthor(head *types.Header) *common.Address {
// get author using Author() function from: /consensus/clique/clique.go
// In Production: get author using Author() function from: /consensus/bor/bor.go
author, err := s.b.Engine().Author(head)
// make sure we don't send error to the user, return 0x0 instead
if err != nil {
add := common.HexToAddress("0x0000000000000000000000000000000000000000")
return &add
}
// change the coinbase (0x0) with the miner address
return &author
}

// GetBlockByNumber returns the requested canonical block.
// - When blockNr is -1 the chain head is returned.
// - When blockNr is -2 the pending chain head is returned.
Expand All @@ -841,7 +827,6 @@ func (s *PublicBlockChainAPI) getAuthor(head *types.Header) *common.Address {
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 {

response, err := s.rpcMarshalBlock(ctx, block, true, fullTx)
if err == nil && number == rpc.PendingBlockNumber {
// Pending blocks need to nil out a few fields
Expand All @@ -850,12 +835,6 @@ func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.B
}
}

if err == nil && number != rpc.PendingBlockNumber {
author := s.getAuthor(block.Header())

response["miner"] = author
}

// append marshalled bor transaction
if err == nil && response != nil {
response = s.appendRPCMarshalBorTransaction(ctx, block, response, fullTx)
Expand All @@ -874,10 +853,6 @@ func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Ha
response, err := s.rpcMarshalBlock(ctx, block, true, fullTx)
// append marshalled bor transaction
if err == nil && response != nil {
author := s.getAuthor(block.Header())

response["miner"] = author

return s.appendRPCMarshalBorTransaction(ctx, block, response, fullTx), err
}
return response, err
Expand Down