Refactored block & Transaction

* Includes new rlp decoder
This commit is contained in:
obscuren
2014-12-23 13:48:44 +01:00
parent 4b52cd512d
commit 4cd79d8ddd
19 changed files with 498 additions and 616 deletions

View File

@ -3,7 +3,7 @@ package pow
import "math/big"
type Block interface {
Diff() *big.Int
Difficulty() *big.Int
HashNoNonce() []byte
N() []byte
}

View File

@ -35,7 +35,7 @@ func (pow *EasyPow) Turbo(on bool) {
func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
hash := block.HashNoNonce()
diff := block.Diff()
diff := block.Difficulty()
i := int64(0)
start := time.Now().UnixNano()
t := time.Now()
@ -89,5 +89,5 @@ func verify(hash []byte, diff *big.Int, nonce []byte) bool {
}
func Verify(block pow.Block) bool {
return verify(block.HashNoNonce(), block.Diff(), block.N())
return verify(block.HashNoNonce(), block.Difficulty(), block.N())
}