NewForTesting creates a proof of work for use in unit tests. It uses a smaller DAG and cache size to keep test times low. DAG files are stored in a temporary directory. Nonces found by a testing instance are not verifiable with a regular-size cache.
()
| 510 | // Nonces found by a testing instance are not verifiable with a |
| 511 | // regular-size cache. |
| 512 | func NewForTesting() (*Ethash, error) { |
| 513 | dir, err := ioutil.TempDir("", "ethash-test") |
| 514 | if err != nil { |
| 515 | return nil, err |
| 516 | } |
| 517 | return &Ethash{&Light{test: true}, &Full{Dir: dir, test: true}}, nil |
| 518 | } |
| 519 | |
| 520 | func GetSeedHash(blockNum uint64) ([]byte, error) { |
| 521 | if blockNum >= epochLength*2048 { |
no outgoing calls