aboutsummaryrefslogtreecommitdiffstats
path: root/tests/transaction_test_util.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-02-19 21:41:57 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-02-19 21:41:57 +0800
commitf8d98f7fcd08bd2eff36d5366ac2a14b52255d57 (patch)
tree99111d4f80ee4c436c99813ef8ffe7a7b16ee8ce /tests/transaction_test_util.go
parentc305005d831eccf9d65c7b55f817390d2334e666 (diff)
parent5b283663b40dbc06c56cc481ef90f4365ab85724 (diff)
downloaddexon-f8d98f7fcd08bd2eff36d5366ac2a14b52255d57.tar
dexon-f8d98f7fcd08bd2eff36d5366ac2a14b52255d57.tar.gz
dexon-f8d98f7fcd08bd2eff36d5366ac2a14b52255d57.tar.bz2
dexon-f8d98f7fcd08bd2eff36d5366ac2a14b52255d57.tar.lz
dexon-f8d98f7fcd08bd2eff36d5366ac2a14b52255d57.tar.xz
dexon-f8d98f7fcd08bd2eff36d5366ac2a14b52255d57.tar.zst
dexon-f8d98f7fcd08bd2eff36d5366ac2a14b52255d57.zip
Merge pull request #2116 from obscuren/homestead
core, core/vm: consensus changes necessary for the homestead release
Diffstat (limited to 'tests/transaction_test_util.go')
-rw-r--r--tests/transaction_test_util.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/transaction_test_util.go b/tests/transaction_test_util.go
index 09511acb7..6302b9d5b 100644
--- a/tests/transaction_test_util.go
+++ b/tests/transaction_test_util.go
@@ -21,11 +21,13 @@ import (
"errors"
"fmt"
"io"
+ "math/big"
"runtime"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
)
@@ -43,6 +45,7 @@ type TtTransaction struct {
}
type TransactionTest struct {
+ Blocknumber string
Rlp string
Sender string
Transaction TtTransaction
@@ -88,6 +91,8 @@ func RunTransactionTests(file string, skipTests []string) error {
}
func runTransactionTests(tests map[string]TransactionTest, skipTests []string) error {
+ params.HomesteadBlock = big.NewInt(900000)
+
skipTest := make(map[string]bool, len(skipTests))
for _, name := range skipTests {
skipTest[name] = true
@@ -102,7 +107,7 @@ func runTransactionTests(tests map[string]TransactionTest, skipTests []string) e
// test the block
if err := runTransactionTest(test); err != nil {
- return err
+ return fmt.Errorf("%s: %v", name, err)
}
glog.Infoln("Transaction test passed: ", name)
@@ -120,7 +125,7 @@ func runTransactionTest(txTest TransactionTest) (err error) {
return nil
} else {
// RLP decoding failed but is expected to succeed (test FAIL)
- return fmt.Errorf("RLP decoding failed when expected to succeed: ", err)
+ return fmt.Errorf("RLP decoding failed when expected to succeed: %s", err)
}
}
@@ -142,7 +147,7 @@ func runTransactionTest(txTest TransactionTest) (err error) {
return nil
} else {
// RLP decoding works and validations pass (test FAIL)
- return fmt.Errorf("Field validations failed after RLP decoding: ", validationError)
+ return fmt.Errorf("Field validations failed after RLP decoding: %s", validationError)
}
}
return errors.New("Should not happen: verify RLP decoding and field validation")
@@ -157,7 +162,15 @@ func verifyTxFields(txTest TransactionTest, decodedTx *types.Transaction) (err e
}
}()
- decodedSender, err := decodedTx.From()
+ var (
+ decodedSender common.Address
+ )
+
+ if params.IsHomestead(common.String2Big(txTest.Blocknumber)) {
+ decodedSender, err = decodedTx.From()
+ } else {
+ decodedSender, err = decodedTx.FromFrontier()
+ }
if err != nil {
return err
}