aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-07-07 16:32:05 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-07 16:32:05 +0800
commit35cd355c14d9a5266a7d4b11127d25eb7f961494 (patch)
tree879c8d86b8865f733c73992e8c04c71d52152437 /tests
parentd764bd058457cd9eb91d205d1ac187d40c4866d6 (diff)
downloadgo-tangerine-35cd355c14d9a5266a7d4b11127d25eb7f961494.tar.gz
go-tangerine-35cd355c14d9a5266a7d4b11127d25eb7f961494.tar.zst
go-tangerine-35cd355c14d9a5266a7d4b11127d25eb7f961494.zip
cmd,eth,rpc,tests: default coinbase
Diffstat (limited to 'tests')
-rw-r--r--tests/block_test_util.go2
-rw-r--r--tests/state_test_util.go20
2 files changed, 12 insertions, 10 deletions
diff --git a/tests/block_test_util.go b/tests/block_test_util.go
index 3b20da492..459e2baee 100644
--- a/tests/block_test_util.go
+++ b/tests/block_test_util.go
@@ -180,7 +180,7 @@ func (test *BlockTest) makeEthConfig() *eth.Config {
return &eth.Config{
DataDir: common.DefaultDataDir(),
Verbosity: 5,
- Etherbase: "primary",
+ Etherbase: common.Address{},
AccountManager: accounts.NewManager(ks),
NewDB: func(path string) (common.Database, error) { return ethdb.NewMemDatabase() },
}
diff --git a/tests/state_test_util.go b/tests/state_test_util.go
index 7f1a22ac0..dbbd08729 100644
--- a/tests/state_test_util.go
+++ b/tests/state_test_util.go
@@ -2,6 +2,7 @@ package tests
import (
"bytes"
+ "encoding/hex"
"fmt"
"io"
"math/big"
@@ -147,13 +148,12 @@ func runStateTest(test VmTest) error {
func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, state.Logs, *big.Int, error) {
var (
- keyPair, _ = crypto.NewKeyPairFromSec([]byte(common.Hex2Bytes(tx["secretKey"])))
- data = common.FromHex(tx["data"])
- gas = common.Big(tx["gasLimit"])
- price = common.Big(tx["gasPrice"])
- value = common.Big(tx["value"])
- nonce = common.Big(tx["nonce"]).Uint64()
- caddr = common.HexToAddress(env["currentCoinbase"])
+ data = common.FromHex(tx["data"])
+ gas = common.Big(tx["gasLimit"])
+ price = common.Big(tx["gasPrice"])
+ value = common.Big(tx["value"])
+ nonce = common.Big(tx["nonce"]).Uint64()
+ caddr = common.HexToAddress(env["currentCoinbase"])
)
var to *common.Address
@@ -168,9 +168,11 @@ func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, state.
coinbase := statedb.GetOrNewStateObject(caddr)
coinbase.SetGasLimit(common.Big(env["currentGasLimit"]))
- message := NewMessage(common.BytesToAddress(keyPair.Address()), to, data, value, gas, price, nonce)
+ key, _ := hex.DecodeString(tx["secretKey"])
+ addr := crypto.PubkeyToAddress(crypto.ToECDSA(key).PublicKey)
+ message := NewMessage(addr, to, data, value, gas, price, nonce)
vmenv := NewEnvFromMap(statedb, env, tx)
- vmenv.origin = common.BytesToAddress(keyPair.Address())
+ vmenv.origin = addr
ret, _, err := core.ApplyMessage(vmenv, message, coinbase)
if core.IsNonceErr(err) || core.IsInvalidTxErr(err) || state.IsGasLimitErr(err) {
statedb.Set(snapshot)