diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-11 04:44:20 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-11 04:44:20 +0800 |
commit | cb845b9bc84dada9d03eb9d9cb9ccfa96c7ce06c (patch) | |
tree | 30c988dce0ecc9e31725fedaba8ed1dab2636004 /pow/ar/pow_test.go | |
parent | 56843ca0fca1886213be4ee1e25995a537afda57 (diff) | |
download | go-tangerine-cb845b9bc84dada9d03eb9d9cb9ccfa96c7ce06c.tar go-tangerine-cb845b9bc84dada9d03eb9d9cb9ccfa96c7ce06c.tar.gz go-tangerine-cb845b9bc84dada9d03eb9d9cb9ccfa96c7ce06c.tar.bz2 go-tangerine-cb845b9bc84dada9d03eb9d9cb9ccfa96c7ce06c.tar.lz go-tangerine-cb845b9bc84dada9d03eb9d9cb9ccfa96c7ce06c.tar.xz go-tangerine-cb845b9bc84dada9d03eb9d9cb9ccfa96c7ce06c.tar.zst go-tangerine-cb845b9bc84dada9d03eb9d9cb9ccfa96c7ce06c.zip |
Implemented AR PoW
Diffstat (limited to 'pow/ar/pow_test.go')
-rw-r--r-- | pow/ar/pow_test.go | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/pow/ar/pow_test.go b/pow/ar/pow_test.go new file mode 100644 index 000000000..d4d419b3a --- /dev/null +++ b/pow/ar/pow_test.go @@ -0,0 +1,47 @@ +package ar + +import ( + "fmt" + "math/big" + "testing" + + "github.com/ethereum/eth-go/ethdb" + "github.com/ethereum/eth-go/ethtrie" +) + +type TestBlock struct { + trie *ethtrie.Trie +} + +func NewTestBlock() *TestBlock { + db, _ := ethdb.NewMemDatabase() + return &TestBlock{ + trie: ethtrie.New(db, ""), + } +} + +func (self *TestBlock) Diff() *big.Int { + return b(10) +} + +func (self *TestBlock) Trie() *ethtrie.Trie { + return self.trie +} + +func (self *TestBlock) Hash() []byte { + a := make([]byte, 32) + a[0] = 10 + a[1] = 2 + return a +} + +func TestPow(t *testing.T) { + entry := make([]byte, 32) + entry[0] = 255 + + block := NewTestBlock() + + pow := NewTape(block) + nonce := pow.Run(block.Hash()) + fmt.Println("Found nonce", nonce) +} |