2020-08-12 13:47:59 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2020-09-26 21:01:11 +00:00
|
|
|
"fmt"
|
2020-08-12 13:47:59 +00:00
|
|
|
|
|
|
|
"github.com/ledgerwatch/turbo-geth/common"
|
|
|
|
)
|
|
|
|
|
2020-09-26 21:01:11 +00:00
|
|
|
// Coinbase is the address that mining rewards will be sent to
|
2020-08-12 13:47:59 +00:00
|
|
|
func (api *APIImpl) Coinbase(_ context.Context) (common.Address, error) {
|
2020-09-26 21:01:11 +00:00
|
|
|
if api.ethBackend == nil {
|
|
|
|
// We're running in --chaindata mode or otherwise cannot get the backend
|
|
|
|
return common.Address{}, fmt.Errorf(NotAvailableChainData, "eth_coinbase")
|
|
|
|
}
|
2020-08-12 13:47:59 +00:00
|
|
|
return api.ethBackend.Etherbase()
|
|
|
|
}
|