2014-01-03 00:02:24 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func TestVm(t *testing.T) {
|
|
|
|
db, _ := NewMemDatabase()
|
|
|
|
Db = db
|
|
|
|
|
2014-01-03 01:43:49 +02:00
|
|
|
tx := NewTransaction("", 20, []string{
|
2014-01-03 00:02:24 +02:00
|
|
|
"PSH 10",
|
|
|
|
})
|
|
|
|
|
|
|
|
block := CreateBlock("", 0, "", "", 0, 0, "", []*Transaction{tx})
|
|
|
|
db.Put(block.Hash(), block.MarshalRlp())
|
|
|
|
|
|
|
|
bm := NewBlockManager()
|
|
|
|
bm.ProcessBlock( block )
|
2014-01-03 01:43:49 +02:00
|
|
|
contract := block.GetContract(tx.Hash())
|
|
|
|
fmt.Println(contract)
|
|
|
|
fmt.Println("it is", contract.state.Get(string(Encode(0))))
|
2014-01-03 00:02:24 +02:00
|
|
|
}
|
|
|
|
|