2

I red over ethash source code and saw this code:

func CreatePoW(config *Config) (pow.PoW, error) { switch { case config.PowFake: glog.V(logger.Info).Infof("ethash used in fake mode") return pow.PoW(core.FakePow{}), nil case config.PowTest: glog.V(logger.Info).Infof("ethash used in test mode") return ethash.NewForTesting() case config.PowShared: glog.V(logger.Info).Infof("ethash used in shared mode") return ethash.NewShared(), nil default: return ethash.New(), nil } }

What does shared mode mean? And when is ethash in shared mode?

3

I got the answer from Péter Szilágyi on go-ethereum gitter channel so I paste here for people who come by.

If I remember correctly, the "shared PoW" is only used inside our tests. The idea was that generating a PoW DAG, even a small one for testing takes time. Since we have hundreds of thousands of random tests, even small times add up to giant test runtimes, which is completely wasteful given that they use the same DAG anyway. The idea behind the shared PoW was that there's a global DAG instance that is shared between all instances, so when you do an ethash.NewShared it will only generate a new one if non exists currently, otherwise it will return that. Originally all test dags worked like this afaik, and we needed to make it explicit when introducing some tests that actually need multiple generations of dags.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.