aboutsummaryrefslogtreecommitdiffstats
path: root/eth/api.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-03-06 23:20:25 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-03-09 22:50:14 +0800
commitb7d93500f13e3054c81196273ebf676ad8ecb5ba (patch)
tree1b6c60cbb6b235d87f78ff9a814f1a574510215a /eth/api.go
parentdf72e20cc521b43092b9e3cc684836d4d673e126 (diff)
downloadgo-tangerine-b7d93500f13e3054c81196273ebf676ad8ecb5ba.tar
go-tangerine-b7d93500f13e3054c81196273ebf676ad8ecb5ba.tar.gz
go-tangerine-b7d93500f13e3054c81196273ebf676ad8ecb5ba.tar.bz2
go-tangerine-b7d93500f13e3054c81196273ebf676ad8ecb5ba.tar.lz
go-tangerine-b7d93500f13e3054c81196273ebf676ad8ecb5ba.tar.xz
go-tangerine-b7d93500f13e3054c81196273ebf676ad8ecb5ba.tar.zst
go-tangerine-b7d93500f13e3054c81196273ebf676ad8ecb5ba.zip
all: finish integrating Go ethash, delete C++ vendor
Diffstat (limited to 'eth/api.go')
-rw-r--r--eth/api.go25
1 files changed, 3 insertions, 22 deletions
diff --git a/eth/api.go b/eth/api.go
index 3aac34ee0..b17968ebb 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -29,7 +29,6 @@ import (
"strings"
"time"
- "github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core"
@@ -40,7 +39,6 @@ import (
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
- "github.com/ethereum/go-ethereum/rpc"
"golang.org/x/net/context"
)
@@ -137,7 +135,6 @@ func NewPrivateMinerAPI(e *Ethereum) *PrivateMinerAPI {
// Start the miner with the given number of threads. If threads is nil the number of
// workers started is equal to the number of logical CPU's that are usable by this process.
func (s *PrivateMinerAPI) Start(threads *int) (bool, error) {
- s.e.StartAutoDAG()
var err error
if threads == nil {
err = s.e.StartMining(runtime.NumCPU())
@@ -173,25 +170,9 @@ func (s *PrivateMinerAPI) SetEtherbase(etherbase common.Address) bool {
return true
}
-// StartAutoDAG starts auto DAG generation. This will prevent the DAG generating on epoch change
-// which will cause the node to stop mining during the generation process.
-func (s *PrivateMinerAPI) StartAutoDAG() bool {
- s.e.StartAutoDAG()
- return true
-}
-
-// StopAutoDAG stops auto DAG generation
-func (s *PrivateMinerAPI) StopAutoDAG() bool {
- s.e.StopAutoDAG()
- return true
-}
-
-// MakeDAG creates the new DAG for the given block number
-func (s *PrivateMinerAPI) MakeDAG(blockNr rpc.BlockNumber) (bool, error) {
- if err := ethash.MakeDAG(uint64(blockNr.Int64()), ""); err != nil {
- return false, err
- }
- return true, nil
+// GetHashrate returns the current hashrate of the miner.
+func (s *PrivateMinerAPI) GetHashrate() uint64 {
+ return uint64(s.e.miner.HashRate())
}
// PrivateAdminAPI is the collection of Etheruem full node-related APIs