2014-02-15 00:56:09 +02:00
|
|
|
package ethchain
|
|
|
|
|
|
|
|
import (
|
|
|
|
_ "fmt"
|
2014-02-19 12:35:17 +02:00
|
|
|
"github.com/ethereum/eth-go/ethdb"
|
|
|
|
"github.com/ethereum/eth-go/ethutil"
|
|
|
|
"math/big"
|
2014-02-15 00:56:09 +02:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestVm(t *testing.T) {
|
|
|
|
InitFees()
|
2014-02-19 12:35:17 +02:00
|
|
|
ethutil.ReadConfig("")
|
2014-02-15 00:56:09 +02:00
|
|
|
|
2014-02-19 12:35:17 +02:00
|
|
|
db, _ := ethdb.NewMemDatabase()
|
|
|
|
ethutil.Config.Db = db
|
|
|
|
bm := NewBlockManager(nil)
|
2014-02-15 00:56:09 +02:00
|
|
|
|
2014-02-19 12:35:17 +02:00
|
|
|
block := bm.bc.genesisBlock
|
2014-02-24 13:13:22 +02:00
|
|
|
script := Compile([]string{
|
2014-02-19 12:35:17 +02:00
|
|
|
"PUSH",
|
|
|
|
"1",
|
|
|
|
"PUSH",
|
|
|
|
"2",
|
2014-02-15 00:56:09 +02:00
|
|
|
"STOP",
|
|
|
|
})
|
2014-02-24 13:13:22 +02:00
|
|
|
ctrct := NewTransaction(ContractAddr, big.NewInt(200000000), script)
|
2014-02-19 12:35:17 +02:00
|
|
|
bm.ApplyTransactions(block, []*Transaction{ctrct})
|
2014-02-15 00:56:09 +02:00
|
|
|
}
|