@@ -52,7 +52,7 @@ func simTestBackend(testAddr common.Address) *Backend {
5252 )
5353}
5454
55- func newBlobTx (sim * Backend , key * ecdsa.PrivateKey ) (* types.Transaction , error ) {
55+ func newBlobTx (sim * Backend , key * ecdsa.PrivateKey , nonce uint64 ) (* types.Transaction , error ) {
5656 client := sim .Client ()
5757
5858 testBlob := & kzg4844.Blob {0x00 }
@@ -67,12 +67,8 @@ func newBlobTx(sim *Backend, key *ecdsa.PrivateKey) (*types.Transaction, error)
6767
6868 addr := crypto .PubkeyToAddress (key .PublicKey )
6969 chainid , _ := client .ChainID (context .Background ())
70- nonce , err := client .PendingNonceAt (context .Background (), addr )
71- if err != nil {
72- return nil , err
73- }
74-
7570 chainidU256 , _ := uint256 .FromBig (chainid )
71+
7672 tx := types .NewTx (& types.BlobTx {
7773 ChainID : chainidU256 ,
7874 GasTipCap : gasTipCapU256 ,
@@ -88,18 +84,15 @@ func newBlobTx(sim *Backend, key *ecdsa.PrivateKey) (*types.Transaction, error)
8884 return types .SignTx (tx , types .LatestSignerForChainID (chainid ), key )
8985}
9086
91- func newTx (sim * Backend , key * ecdsa.PrivateKey ) (* types.Transaction , error ) {
87+ func newTx (sim * Backend , key * ecdsa.PrivateKey , nonce uint64 ) (* types.Transaction , error ) {
9288 client := sim .Client ()
9389
9490 // create a signed transaction to send
9591 head , _ := client .HeaderByNumber (context .Background (), nil ) // Should be child's, good enough
9692 gasPrice := new (big.Int ).Add (head .BaseFee , big .NewInt (params .GWei ))
9793 addr := crypto .PubkeyToAddress (key .PublicKey )
9894 chainid , _ := client .ChainID (context .Background ())
99- nonce , err := client .PendingNonceAt (context .Background (), addr )
100- if err != nil {
101- return nil , err
102- }
95+
10396 tx := types .NewTx (& types.DynamicFeeTx {
10497 ChainID : chainid ,
10598 Nonce : nonce ,
@@ -161,7 +154,7 @@ func TestSendTransaction(t *testing.T) {
161154 client := sim .Client ()
162155 ctx := context .Background ()
163156
164- signedTx , err := newTx (sim , testKey )
157+ signedTx , err := newTx (sim , testKey , 0 )
165158 if err != nil {
166159 t .Errorf ("could not create transaction: %v" , err )
167160 }
@@ -252,7 +245,7 @@ func TestForkResendTx(t *testing.T) {
252245 parent , _ := client .HeaderByNumber (ctx , nil )
253246
254247 // 2.
255- tx , err := newTx (sim , testKey )
248+ tx , err := newTx (sim , testKey , 0 )
256249 if err != nil {
257250 t .Fatalf ("could not create transaction: %v" , err )
258251 }
@@ -297,7 +290,7 @@ func TestCommitReturnValue(t *testing.T) {
297290 }
298291
299292 // Create a block in the original chain (containing a transaction to force different block hashes)
300- tx , _ := newTx (sim , testKey )
293+ tx , _ := newTx (sim , testKey , 0 )
301294 if err := client .SendTransaction (ctx , tx ); err != nil {
302295 t .Errorf ("sending transaction: %v" , err )
303296 }
0 commit comments