all: swap out the C++ ethash to the pure Go one (mining todo)

This commit is contained in:
Péter Szilágyi
2017-03-05 20:00:01 +02:00
committed by Felix Lange
parent 3b00a77de5
commit 567d41d936
31 changed files with 1348 additions and 1156 deletions

View File

@ -288,15 +288,15 @@ func CreatePoW(config *Config) (pow.PoW, error) {
switch {
case config.PowFake:
log.Warn("Ethash used in fake mode")
return pow.PoW(core.FakePow{}), nil
return pow.FakePow{}, nil
case config.PowTest:
log.Warn("Ethash used in test mode")
return ethash.NewForTesting()
return pow.NewTestEthash(), nil
case config.PowShared:
log.Warn("Ethash used in shared mode")
return ethash.NewShared(), nil
return pow.NewSharedEthash(), nil
default:
return ethash.New(), nil
return pow.NewFullEthash("", ""), nil
}
}

View File

@ -34,6 +34,7 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/pow"
)
var bigTxGas = new(big.Int).SetUint64(params.TxGas)
@ -468,7 +469,7 @@ func testDAOChallenge(t *testing.T, localForked, remoteForked bool, timeout bool
// Create a DAO aware protocol manager
var (
evmux = new(event.TypeMux)
pow = new(core.FakePow)
pow = new(pow.FakePow)
db, _ = ethdb.NewMemDatabase()
genesis = core.WriteGenesisBlockForTesting(db)
config = &params.ChainConfig{DAOForkBlock: big.NewInt(1), DAOForkSupport: localForked}

View File

@ -37,6 +37,7 @@ import (
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/pow"
)
var (
@ -53,7 +54,7 @@ var (
func newTestProtocolManager(fastSync bool, blocks int, generator func(int, *core.BlockGen), newtx chan<- []*types.Transaction) (*ProtocolManager, error) {
var (
evmux = new(event.TypeMux)
pow = new(core.FakePow)
pow = new(pow.FakePow)
db, _ = ethdb.NewMemDatabase()
genesis = core.WriteGenesisBlockForTesting(db, testBank)
chainConfig = &params.ChainConfig{HomesteadBlock: big.NewInt(0)} // homestead set to 0 because of chain maker