Persist transactions (#51)
* added account_state + changed ECPoint to PublicKey * account state persist * in depth test for existing accounts. * implemented GetTransaction. * added enrollment TX * added persist of accounts and unspent coins * bumped version -> 0.32.0
This commit is contained in:
parent
a67728628e
commit
52fa41a12a
26 changed files with 930 additions and 66 deletions
|
@ -122,6 +122,21 @@ func TestHasBlock(t *testing.T) {
|
|||
assert.False(t, bc.HasBlock(newBlock.Hash()))
|
||||
}
|
||||
|
||||
func TestGetTransaction(t *testing.T) {
|
||||
block := getDecodedBlock(t, 1)
|
||||
bc := newTestChain(t)
|
||||
|
||||
assert.Nil(t, bc.AddBlock(block))
|
||||
assert.Nil(t, bc.persistBlock(block))
|
||||
|
||||
tx, height, err := bc.GetTransaction(block.Transactions[0].Hash())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, block.Index, height)
|
||||
assert.Equal(t, block.Transactions[0], tx)
|
||||
}
|
||||
|
||||
func newTestChain(t *testing.T) *Blockchain {
|
||||
startHash, _ := util.Uint256DecodeString("a")
|
||||
chain, err := NewBlockchain(storage.NewMemoryStore(), startHash)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue