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-10-14 15:59:42 +00:00
|
|
|
"github.com/ledgerwatch/turbo-geth/rpc"
|
2020-08-12 13:47:59 +00:00
|
|
|
)
|
|
|
|
|
2020-10-12 08:39:33 +00:00
|
|
|
// Propose changing this file name to eth_mining.go and adding missing mining related commands
|
|
|
|
|
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-10-14 15:59:42 +00:00
|
|
|
var stub common.Address
|
|
|
|
return stub, fmt.Errorf(NotImplemented, "eth_coinbase")
|
|
|
|
// if api.ethBackend == nil {
|
|
|
|
// // We're running in --chaindata mode or otherwise cannot get the backend
|
|
|
|
// return common.Address{}, fmt.Errorf(NotAvailableChainData, "eth_coinbase")
|
|
|
|
// }
|
|
|
|
// return api.ethBackend.Etherbase()
|
2020-08-12 13:47:59 +00:00
|
|
|
}
|
2020-10-12 08:39:33 +00:00
|
|
|
|
2020-10-14 15:59:42 +00:00
|
|
|
// Hashrate returns the number of hashes per second that the node is mining with.
|
|
|
|
func (api *APIImpl) Hashrate(_ context.Context) (uint64, error) {
|
|
|
|
return 0, fmt.Errorf(NotImplemented, "eth_hashRate")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mining returns true if client is actively mining new blocks.
|
|
|
|
func (api *APIImpl) Mining(_ context.Context) (bool, error) {
|
|
|
|
return false, fmt.Errorf(NotImplemented, "eth_mining")
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetWork returns the hash of the current block, the seedHash, and the boundary condition to be met.
|
|
|
|
// Returns Array - Array with the following properties:
|
|
|
|
// DATA, 32 Bytes - current block header pow-hash
|
|
|
|
// DATA, 32 Bytes - the seed hash used for the DAG.
|
|
|
|
// DATA, 32 Bytes - the boundary condition ("target"), 2^256 / difficulty.
|
|
|
|
func (api *APIImpl) GetWork(_ context.Context) ([]interface{}, error) {
|
|
|
|
var stub []interface{}
|
|
|
|
return stub, fmt.Errorf(NotImplemented, "eth_getWork")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SubmitWork used for submitting a proof-of-work solution.
|
|
|
|
func (api *APIImpl) SubmitWork(_ context.Context, nonce rpc.BlockNumber, powHash, digest common.Hash) (bool, error) {
|
|
|
|
return false, fmt.Errorf(NotImplemented, "eth_submitWork")
|
|
|
|
}
|
2020-10-12 08:39:33 +00:00
|
|
|
|
2020-10-14 15:59:42 +00:00
|
|
|
// SubmitHashrate used for submitting mining hashrate.
|
|
|
|
func (api *APIImpl) SubmitHashrate(_ context.Context, hashRate common.Hash, id string) (bool, error) {
|
|
|
|
return false, fmt.Errorf(NotImplemented, "eth_sumitHashrate")
|
|
|
|
}
|