[release/1.3.4] tests: updated homestead tests
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user