@@ -719,7 +719,7 @@ func TestFastVsFullChains(t *testing.T) {
719719 // If the block number is multiple of 3, send a few bonus transactions to the miner
720720 if i % 3 == 2 {
721721 for j := 0 ; j < i % 4 + 1 ; j ++ {
722- tx , err := types .NewTransaction (block .TxNonce (address ), common.Address {0x00 }, big .NewInt (1000 ), params .TxGas , nil , nil ). SignECDSA ( signer , key )
722+ tx , err := types .SignTx ( types . NewTransaction (block .TxNonce (address ), common.Address {0x00 }, big .NewInt (1000 ), params .TxGas , nil , nil ), signer , key )
723723 if err != nil {
724724 panic (err )
725725 }
@@ -883,8 +883,8 @@ func TestChainTxReorgs(t *testing.T) {
883883 // Create two transactions shared between the chains:
884884 // - postponed: transaction included at a later block in the forked chain
885885 // - swapped: transaction included at the same block number in the forked chain
886- postponed , _ := types .NewTransaction (0 , addr1 , big .NewInt (1000 ), params .TxGas , nil , nil ). SignECDSA ( signer , key1 )
887- swapped , _ := types .NewTransaction (1 , addr1 , big .NewInt (1000 ), params .TxGas , nil , nil ). SignECDSA ( signer , key1 )
886+ postponed , _ := types .SignTx ( types . NewTransaction (0 , addr1 , big .NewInt (1000 ), params .TxGas , nil , nil ), signer , key1 )
887+ swapped , _ := types .SignTx ( types . NewTransaction (1 , addr1 , big .NewInt (1000 ), params .TxGas , nil , nil ), signer , key1 )
888888
889889 // Create two transactions that will be dropped by the forked chain:
890890 // - pastDrop: transaction dropped retroactively from a past block
@@ -900,13 +900,13 @@ func TestChainTxReorgs(t *testing.T) {
900900 chain , _ := GenerateChain (params .TestChainConfig , genesis , db , 3 , func (i int , gen * BlockGen ) {
901901 switch i {
902902 case 0 :
903- pastDrop , _ = types .NewTransaction (gen .TxNonce (addr2 ), addr2 , big .NewInt (1000 ), params .TxGas , nil , nil ). SignECDSA ( signer , key2 )
903+ pastDrop , _ = types .SignTx ( types . NewTransaction (gen .TxNonce (addr2 ), addr2 , big .NewInt (1000 ), params .TxGas , nil , nil ), signer , key2 )
904904
905905 gen .AddTx (pastDrop ) // This transaction will be dropped in the fork from below the split point
906906 gen .AddTx (postponed ) // This transaction will be postponed till block #3 in the fork
907907
908908 case 2 :
909- freshDrop , _ = types .NewTransaction (gen .TxNonce (addr2 ), addr2 , big .NewInt (1000 ), params .TxGas , nil , nil ). SignECDSA ( signer , key2 )
909+ freshDrop , _ = types .SignTx ( types . NewTransaction (gen .TxNonce (addr2 ), addr2 , big .NewInt (1000 ), params .TxGas , nil , nil ), signer , key2 )
910910
911911 gen .AddTx (freshDrop ) // This transaction will be dropped in the fork from exactly at the split point
912912 gen .AddTx (swapped ) // This transaction will be swapped out at the exact height
@@ -925,18 +925,18 @@ func TestChainTxReorgs(t *testing.T) {
925925 chain , _ = GenerateChain (params .TestChainConfig , genesis , db , 5 , func (i int , gen * BlockGen ) {
926926 switch i {
927927 case 0 :
928- pastAdd , _ = types .NewTransaction (gen .TxNonce (addr3 ), addr3 , big .NewInt (1000 ), params .TxGas , nil , nil ). SignECDSA ( signer , key3 )
928+ pastAdd , _ = types .SignTx ( types . NewTransaction (gen .TxNonce (addr3 ), addr3 , big .NewInt (1000 ), params .TxGas , nil , nil ), signer , key3 )
929929 gen .AddTx (pastAdd ) // This transaction needs to be injected during reorg
930930
931931 case 2 :
932932 gen .AddTx (postponed ) // This transaction was postponed from block #1 in the original chain
933933 gen .AddTx (swapped ) // This transaction was swapped from the exact current spot in the original chain
934934
935- freshAdd , _ = types .NewTransaction (gen .TxNonce (addr3 ), addr3 , big .NewInt (1000 ), params .TxGas , nil , nil ). SignECDSA ( signer , key3 )
935+ freshAdd , _ = types .SignTx ( types . NewTransaction (gen .TxNonce (addr3 ), addr3 , big .NewInt (1000 ), params .TxGas , nil , nil ), signer , key3 )
936936 gen .AddTx (freshAdd ) // This transaction will be added exactly at reorg time
937937
938938 case 3 :
939- futureAdd , _ = types .NewTransaction (gen .TxNonce (addr3 ), addr3 , big .NewInt (1000 ), params .TxGas , nil , nil ). SignECDSA ( signer , key3 )
939+ futureAdd , _ = types .SignTx ( types . NewTransaction (gen .TxNonce (addr3 ), addr3 , big .NewInt (1000 ), params .TxGas , nil , nil ), signer , key3 )
940940 gen .AddTx (futureAdd ) // This transaction will be added after a full reorg
941941 }
942942 })
@@ -995,7 +995,7 @@ func TestLogReorgs(t *testing.T) {
995995 subs := evmux .Subscribe (RemovedLogsEvent {})
996996 chain , _ := GenerateChain (params .TestChainConfig , genesis , db , 2 , func (i int , gen * BlockGen ) {
997997 if i == 1 {
998- tx , err := types .NewContractCreation (gen .TxNonce (addr1 ), new (big.Int ), big .NewInt (1000000 ), new (big.Int ), code ). SignECDSA ( signer , key1 )
998+ tx , err := types .SignTx ( types . NewContractCreation (gen .TxNonce (addr1 ), new (big.Int ), big .NewInt (1000000 ), new (big.Int ), code ), signer , key1 )
999999 if err != nil {
10001000 t .Fatalf ("failed to create tx: %v" , err )
10011001 }
@@ -1035,7 +1035,7 @@ func TestReorgSideEvent(t *testing.T) {
10351035 }
10361036
10371037 replacementBlocks , _ := GenerateChain (params .TestChainConfig , genesis , db , 4 , func (i int , gen * BlockGen ) {
1038- tx , err := types .NewContractCreation (gen .TxNonce (addr1 ), new (big.Int ), big .NewInt (1000000 ), new (big.Int ), nil ). SignECDSA ( signer , key1 )
1038+ tx , err := types .SignTx ( types . NewContractCreation (gen .TxNonce (addr1 ), new (big.Int ), big .NewInt (1000000 ), new (big.Int ), nil ), signer , key1 )
10391039 if i == 2 {
10401040 gen .OffsetTime (- 1 )
10411041 }
@@ -1152,7 +1152,7 @@ func TestEIP155Transition(t *testing.T) {
11521152 tx * types.Transaction
11531153 err error
11541154 basicTx = func (signer types.Signer ) (* types.Transaction , error ) {
1155- return types .NewTransaction (block .TxNonce (address ), common.Address {}, new (big.Int ), big .NewInt (21000 ), new (big.Int ), nil ). SignECDSA ( signer , key )
1155+ return types .SignTx ( types . NewTransaction (block .TxNonce (address ), common.Address {}, new (big.Int ), big .NewInt (21000 ), new (big.Int ), nil ), signer , key )
11561156 }
11571157 )
11581158 switch i {
@@ -1215,7 +1215,7 @@ func TestEIP155Transition(t *testing.T) {
12151215 tx * types.Transaction
12161216 err error
12171217 basicTx = func (signer types.Signer ) (* types.Transaction , error ) {
1218- return types .NewTransaction (block .TxNonce (address ), common.Address {}, new (big.Int ), big .NewInt (21000 ), new (big.Int ), nil ). SignECDSA ( signer , key )
1218+ return types .SignTx ( types . NewTransaction (block .TxNonce (address ), common.Address {}, new (big.Int ), big .NewInt (21000 ), new (big.Int ), nil ), signer , key )
12191219 }
12201220 )
12211221 switch i {
@@ -1260,11 +1260,11 @@ func TestEIP161AccountRemoval(t *testing.T) {
12601260 )
12611261 switch i {
12621262 case 0 :
1263- tx , err = types .NewTransaction (block .TxNonce (address ), theAddr , new (big.Int ), big .NewInt (21000 ), new (big.Int ), nil ). SignECDSA ( signer , key )
1263+ tx , err = types .SignTx ( types . NewTransaction (block .TxNonce (address ), theAddr , new (big.Int ), big .NewInt (21000 ), new (big.Int ), nil ), signer , key )
12641264 case 1 :
1265- tx , err = types .NewTransaction (block .TxNonce (address ), theAddr , new (big.Int ), big .NewInt (21000 ), new (big.Int ), nil ). SignECDSA ( signer , key )
1265+ tx , err = types .SignTx ( types . NewTransaction (block .TxNonce (address ), theAddr , new (big.Int ), big .NewInt (21000 ), new (big.Int ), nil ), signer , key )
12661266 case 2 :
1267- tx , err = types .NewTransaction (block .TxNonce (address ), theAddr , new (big.Int ), big .NewInt (21000 ), new (big.Int ), nil ). SignECDSA ( signer , key )
1267+ tx , err = types .SignTx ( types . NewTransaction (block .TxNonce (address ), theAddr , new (big.Int ), big .NewInt (21000 ), new (big.Int ), nil ), signer , key )
12681268 }
12691269 if err != nil {
12701270 t .Fatal (err )
0 commit comments