go-ethereum/ethchain/block_manager_test.go

37 lines
730 B
Go
Raw Normal View History

2014-02-14 16:56:09 -06:00
package ethchain
2014-03-20 11:24:53 -05:00
/*
2014-02-14 16:56:09 -06:00
import (
_ "fmt"
2014-02-19 04:35:17 -06:00
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethutil"
"math/big"
2014-02-14 16:56:09 -06:00
"testing"
)
func TestVm(t *testing.T) {
InitFees()
2014-02-19 04:35:17 -06:00
ethutil.ReadConfig("")
2014-02-14 16:56:09 -06:00
2014-02-19 04:35:17 -06:00
db, _ := ethdb.NewMemDatabase()
ethutil.Config.Db = db
2014-03-20 11:24:53 -05:00
bm := NewStateManager(nil)
2014-02-14 16:56:09 -06:00
2014-02-19 04:35:17 -06:00
block := bm.bc.genesisBlock
2014-03-20 11:24:53 -05:00
bm.Prepare(block.State(), block.State())
2014-02-24 05:13:22 -06:00
script := Compile([]string{
2014-02-19 04:35:17 -06:00
"PUSH",
"1",
"PUSH",
"2",
2014-02-14 16:56:09 -06:00
})
2014-02-24 05:44:29 -06:00
tx := NewTransaction(ContractAddr, big.NewInt(200000000), script)
addr := tx.Hash()[12:]
bm.ApplyTransactions(block, []*Transaction{tx})
tx2 := NewTransaction(addr, big.NewInt(1e17), nil)
tx2.Sign([]byte("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
bm.ApplyTransactions(block, []*Transaction{tx2})
2014-02-14 16:56:09 -06:00
}
2014-03-20 11:24:53 -05:00
*/