diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-30 06:44:23 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-30 06:44:23 +0800 |
commit | 7c4ed8055cc036214279e3ebded74c58d6808d05 (patch) | |
tree | b35a10b7a41c5e1f03300c7afb51f8a76202dbf8 /tests/transaction_test_util.go | |
parent | 9d8b512b27f691fc1980b850e04eb436a3938626 (diff) | |
parent | 992e4f83cb05946fa53132a9184d4ac3f38b62bc (diff) | |
download | go-tangerine-7c4ed8055cc036214279e3ebded74c58d6808d05.tar.gz go-tangerine-7c4ed8055cc036214279e3ebded74c58d6808d05.tar.zst go-tangerine-7c4ed8055cc036214279e3ebded74c58d6808d05.zip |
Merge pull request #1357 from obscuren/core-optimisations-2
core: optimisations
Diffstat (limited to 'tests/transaction_test_util.go')
-rw-r--r-- | tests/transaction_test_util.go | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/tests/transaction_test_util.go b/tests/transaction_test_util.go index 45caf26fd..1c92090db 100644 --- a/tests/transaction_test_util.go +++ b/tests/transaction_test_util.go @@ -152,54 +152,53 @@ func verifyTxFields(txTest TransactionTest, decodedTx *types.Transaction) (err e } expectedData := mustConvertBytes(txTest.Transaction.Data) - if !bytes.Equal(expectedData, decodedTx.Payload) { - return fmt.Errorf("Tx input data mismatch: %#v %#v", expectedData, decodedTx.Payload) + if !bytes.Equal(expectedData, decodedTx.Data()) { + return fmt.Errorf("Tx input data mismatch: %#v %#v", expectedData, decodedTx.Data()) } expectedGasLimit := mustConvertBigInt(txTest.Transaction.GasLimit, 16) - if expectedGasLimit.Cmp(decodedTx.GasLimit) != 0 { - return fmt.Errorf("GasLimit mismatch: %v %v", expectedGasLimit, decodedTx.GasLimit) + if expectedGasLimit.Cmp(decodedTx.Gas()) != 0 { + return fmt.Errorf("GasLimit mismatch: %v %v", expectedGasLimit, decodedTx.Gas()) } expectedGasPrice := mustConvertBigInt(txTest.Transaction.GasPrice, 16) - if expectedGasPrice.Cmp(decodedTx.Price) != 0 { - return fmt.Errorf("GasPrice mismatch: %v %v", expectedGasPrice, decodedTx.Price) + if expectedGasPrice.Cmp(decodedTx.GasPrice()) != 0 { + return fmt.Errorf("GasPrice mismatch: %v %v", expectedGasPrice, decodedTx.GasPrice()) } expectedNonce := mustConvertUint(txTest.Transaction.Nonce, 16) - if expectedNonce != decodedTx.AccountNonce { - return fmt.Errorf("Nonce mismatch: %v %v", expectedNonce, decodedTx.AccountNonce) + if expectedNonce != decodedTx.Nonce() { + return fmt.Errorf("Nonce mismatch: %v %v", expectedNonce, decodedTx.Nonce()) } - expectedR := common.Bytes2Big(mustConvertBytes(txTest.Transaction.R)) - if expectedR.Cmp(decodedTx.R) != 0 { - return fmt.Errorf("R mismatch: %v %v", expectedR, decodedTx.R) + v, r, s := decodedTx.SignatureValues() + expectedR := mustConvertBigInt(txTest.Transaction.R, 16) + if r.Cmp(expectedR) != 0 { + return fmt.Errorf("R mismatch: %v %v", expectedR, r) } - - expectedS := common.Bytes2Big(mustConvertBytes(txTest.Transaction.S)) - if expectedS.Cmp(decodedTx.S) != 0 { - return fmt.Errorf("S mismatch: %v %v", expectedS, decodedTx.S) + expectedS := mustConvertBigInt(txTest.Transaction.S, 16) + if s.Cmp(expectedS) != 0 { + return fmt.Errorf("S mismatch: %v %v", expectedS, s) } - expectedV := mustConvertUint(txTest.Transaction.V, 16) - if expectedV != uint64(decodedTx.V) { - return fmt.Errorf("V mismatch: %v %v", expectedV, uint64(decodedTx.V)) + if uint64(v) != expectedV { + return fmt.Errorf("V mismatch: %v %v", expectedV, v) } expectedTo := mustConvertAddress(txTest.Transaction.To) - if decodedTx.Recipient == nil { + if decodedTx.To() == nil { if expectedTo != common.BytesToAddress([]byte{}) { // "empty" or "zero" address return fmt.Errorf("To mismatch when recipient is nil (contract creation): %v", expectedTo) } } else { - if expectedTo != *decodedTx.Recipient { - return fmt.Errorf("To mismatch: %v %v", expectedTo, *decodedTx.Recipient) + if expectedTo != *decodedTx.To() { + return fmt.Errorf("To mismatch: %v %v", expectedTo, *decodedTx.To()) } } expectedValue := mustConvertBigInt(txTest.Transaction.Value, 16) - if expectedValue.Cmp(decodedTx.Amount) != 0 { - return fmt.Errorf("Value mismatch: %v %v", expectedValue, decodedTx.Amount) + if expectedValue.Cmp(decodedTx.Value()) != 0 { + return fmt.Errorf("Value mismatch: %v %v", expectedValue, decodedTx.Value()) } return nil |