diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-02-29 22:05:37 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-02-29 22:05:37 +0800 |
commit | 4044a8cea44cd4cee3a8ddaf51a76b71c9d22042 (patch) | |
tree | 1aa3776381e8e117b66e4a8ed1bf83e29d966ff1 /tests/transaction_test_util.go | |
parent | c541b38fb36587d23c60f5e2f2b9b3c8700ec489 (diff) | |
parent | 61be63bb9b8527bb3e2357ad35a0f4ef29304da1 (diff) | |
download | go-tangerine-1.3.4.tar go-tangerine-1.3.4.tar.gz go-tangerine-1.3.4.tar.bz2 go-tangerine-1.3.4.tar.lz go-tangerine-1.3.4.tar.xz go-tangerine-1.3.4.tar.zst go-tangerine-1.3.4.zip |
Merge pull request #2258 from obscuren/release/1.3.4v1.3.4
Homestead Release Candidate
Diffstat (limited to 'tests/transaction_test_util.go')
-rw-r--r-- | tests/transaction_test_util.go | 21 |
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 } |