mirror of https://github.com/ethereum/go-ethereum
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
682 B
33 lines
682 B
package ethchain
|
|
|
|
import (
|
|
_ "fmt"
|
|
"github.com/ethereum/eth-go/ethdb"
|
|
"github.com/ethereum/eth-go/ethutil"
|
|
"math/big"
|
|
"testing"
|
|
)
|
|
|
|
func TestVm(t *testing.T) {
|
|
InitFees()
|
|
ethutil.ReadConfig("")
|
|
|
|
db, _ := ethdb.NewMemDatabase()
|
|
ethutil.Config.Db = db
|
|
bm := NewBlockManager(nil)
|
|
|
|
block := bm.bc.genesisBlock
|
|
script := Compile([]string{
|
|
"PUSH",
|
|
"1",
|
|
"PUSH",
|
|
"2",
|
|
})
|
|
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})
|
|
}
|
|
|