Skip to content

Commit

Permalink
Merge pull request #95 from karalabe/deprecate
Browse files Browse the repository at this point in the history
ethash, vendor: self contain and deprecate Go ethash
  • Loading branch information
karalabe committed Apr 7, 2017
2 parents dd61087 + be47ab5 commit 1490e88
Show file tree
Hide file tree
Showing 156 changed files with 33,567 additions and 3 deletions.
31 changes: 31 additions & 0 deletions compat.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2017 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package ethash

import (
"math/big"

"github.com/ethereum/go-ethereum/common"
)

type Block interface {
Difficulty() *big.Int
HashNoNonce() common.Hash
Nonce() uint64
MixDigest() common.Hash
NumberU64() uint64
}
5 changes: 2 additions & 3 deletions ethash.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/pow"
)

var (
Expand Down Expand Up @@ -126,7 +125,7 @@ type Light struct {
}

// Verify checks whether the block's nonce is valid.
func (l *Light) Verify(block pow.Block) bool {
func (l *Light) Verify(block Block) bool {
// TODO: do ethash_quick_verify before getCache in order
// to prevent DOS attacks.
blockNum := block.NumberU64()
Expand Down Expand Up @@ -333,7 +332,7 @@ func (pow *Full) getDAG(blockNum uint64) (d *dag) {
return d
}

func (pow *Full) Search(block pow.Block, stop <-chan struct{}, index int) (nonce uint64, mixDigest []byte) {
func (pow *Full) Search(block Block, stop <-chan struct{}, index int) (nonce uint64, mixDigest []byte) {
dag := pow.getDAG(block.NumberU64())

r := rand.New(rand.NewSource(time.Now().UnixNano()))
Expand Down
16 changes: 16 additions & 0 deletions vendor/github.com/btcsuite/btcd/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions vendor/github.com/btcsuite/btcd/btcec/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1490e88

Please sign in to comment.