2014-01-02 16:02:24 -06:00
|
|
|
package main
|
|
|
|
|
2014-01-09 09:19:16 -06:00
|
|
|
/*
|
2014-01-02 16:02:24 -06:00
|
|
|
import (
|
2014-01-03 06:40:12 -06:00
|
|
|
_"fmt"
|
2014-01-02 16:02:24 -06:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func TestVm(t *testing.T) {
|
2014-01-03 17:32:52 -06:00
|
|
|
InitFees()
|
|
|
|
|
2014-01-02 16:02:24 -06:00
|
|
|
db, _ := NewMemDatabase()
|
|
|
|
Db = db
|
|
|
|
|
2014-01-03 17:32:52 -06:00
|
|
|
ctrct := NewTransaction("", 200000000, []string{
|
|
|
|
"PUSH", "1a2f2e",
|
|
|
|
"PUSH", "hallo",
|
2014-01-03 06:40:12 -06:00
|
|
|
"POP", // POP hallo
|
2014-01-03 17:32:52 -06:00
|
|
|
"PUSH", "3",
|
2014-01-03 06:40:12 -06:00
|
|
|
"LOAD", // Load hallo back on the stack
|
2014-01-03 17:32:52 -06:00
|
|
|
|
|
|
|
"PUSH", "1",
|
|
|
|
"PUSH", "2",
|
|
|
|
"ADD",
|
|
|
|
|
|
|
|
"PUSH", "2",
|
|
|
|
"PUSH", "1",
|
|
|
|
"SUB",
|
|
|
|
|
|
|
|
"PUSH", "100000000000000000000000",
|
|
|
|
"PUSH", "10000000000000",
|
|
|
|
"SDIV",
|
|
|
|
|
|
|
|
"PUSH", "105",
|
|
|
|
"PUSH", "200",
|
|
|
|
"MOD",
|
|
|
|
|
|
|
|
"PUSH", "100000000000000000000000",
|
|
|
|
"PUSH", "10000000000000",
|
|
|
|
"SMOD",
|
|
|
|
|
|
|
|
"PUSH", "5",
|
|
|
|
"PUSH", "10",
|
|
|
|
"LT",
|
|
|
|
|
|
|
|
"PUSH", "5",
|
|
|
|
"PUSH", "5",
|
|
|
|
"LE",
|
|
|
|
|
|
|
|
"PUSH", "50",
|
|
|
|
"PUSH", "5",
|
|
|
|
"GT",
|
|
|
|
|
|
|
|
"PUSH", "5",
|
|
|
|
"PUSH", "5",
|
|
|
|
"GE",
|
|
|
|
|
|
|
|
"PUSH", "10",
|
|
|
|
"PUSH", "10",
|
|
|
|
"NOT",
|
|
|
|
|
|
|
|
"MYADDRESS",
|
|
|
|
"TXSENDER",
|
|
|
|
|
2014-01-03 06:40:12 -06:00
|
|
|
"STOP",
|
2014-01-02 16:02:24 -06:00
|
|
|
})
|
2014-01-03 06:40:12 -06:00
|
|
|
tx := NewTransaction("1e8a42ea8cce13", 100, []string{})
|
2014-01-02 16:02:24 -06:00
|
|
|
|
2014-01-03 17:32:52 -06:00
|
|
|
block := CreateBlock("", 0, "", "c014ba53", 0, 0, "", []*Transaction{ctrct, tx})
|
2014-01-02 16:02:24 -06:00
|
|
|
db.Put(block.Hash(), block.MarshalRlp())
|
|
|
|
|
|
|
|
bm := NewBlockManager()
|
|
|
|
bm.ProcessBlock( block )
|
|
|
|
}
|
2014-01-09 09:19:16 -06:00
|
|
|
*/
|