diff options
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 } |