2014-01-02 22:02:24 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2014-01-03 12:40:12 +00:00
|
|
|
_"fmt"
|
2014-01-02 22:02:24 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func TestVm(t *testing.T) {
|
|
|
|
db, _ := NewMemDatabase()
|
|
|
|
Db = db
|
|
|
|
|
2014-01-03 12:40:12 +00:00
|
|
|
ctrct := NewTransaction("", 20, []string{
|
|
|
|
"PUSH",
|
|
|
|
"1a2f2e",
|
|
|
|
"PUSH",
|
|
|
|
"hallo",
|
|
|
|
"POP", // POP hallo
|
|
|
|
"PUSH",
|
|
|
|
"3",
|
|
|
|
"LOAD", // Load hallo back on the stack
|
|
|
|
"STOP",
|
2014-01-02 22:02:24 +00:00
|
|
|
})
|
2014-01-03 12:40:12 +00:00
|
|
|
tx := NewTransaction("1e8a42ea8cce13", 100, []string{})
|
2014-01-02 22:02:24 +00:00
|
|
|
|
2014-01-03 12:40:12 +00:00
|
|
|
block := CreateBlock("", 0, "", "", 0, 0, "", []*Transaction{ctrct, tx})
|
2014-01-02 22:02:24 +00:00
|
|
|
db.Put(block.Hash(), block.MarshalRlp())
|
|
|
|
|
|
|
|
bm := NewBlockManager()
|
|
|
|
bm.ProcessBlock( block )
|
|
|
|
}
|
|
|
|
|