@@ -286,30 +286,15 @@ func (t *Task) generateTransaction(ctx context.Context, transactionIdx uint64, c
286286 txData = t .transactionData
287287 }
288288
289- blobTx , err := txbuilder .BuildBlobTx (& txbuilder.TxMetadata {
290- GasFeeCap : uint256 .MustFromBig (t .config .FeeCap ),
291- GasTipCap : uint256 .MustFromBig (t .config .TipCap ),
292- BlobFeeCap : uint256 .MustFromBig (t .config .BlobFeeCap ),
293- Gas : t .config .GasLimit ,
294- To : & toAddr ,
295- Value : uint256 .MustFromBig (txAmount ),
296- Data : txData ,
297- }, blobRefs )
298- if err != nil {
299- return fmt .Errorf ("cannot build blob tx data: %w" , err )
300- }
301-
302- tx , err := txWallet .BuildBlobTx (blobTx )
303- if err != nil {
304- return fmt .Errorf ("cannot build blob transaction: %w" , err )
305- }
306-
307289 var clients []* execution.Client
308290
309291 clientPool := t .ctx .Scheduler .GetServices ().ClientPool ()
310292
311293 if t .config .ClientPattern == "" && t .config .ExcludeClientPattern == "" {
312- clients = clientPool .GetExecutionPool ().GetReadyEndpoints (true )
294+ clients = clientPool .GetExecutionPool ().AwaitReadyEndpoints (ctx , true )
295+ if len (clients ) == 0 {
296+ return ctx .Err ()
297+ }
313298 } else {
314299 poolClients := clientPool .GetClientsByNamePatterns (t .config .ClientPattern , t .config .ExcludeClientPattern )
315300 if len (poolClients ) == 0 {
@@ -322,14 +307,28 @@ func (t *Task) generateTransaction(ctx context.Context, transactionIdx uint64, c
322307 }
323308 }
324309
325- if len (clients ) == 0 {
326- return fmt .Errorf ("no ready clients available" )
310+ blobTx , err := txbuilder .BuildBlobTx (& txbuilder.TxMetadata {
311+ GasFeeCap : uint256 .MustFromBig (t .config .FeeCap ),
312+ GasTipCap : uint256 .MustFromBig (t .config .TipCap ),
313+ BlobFeeCap : uint256 .MustFromBig (t .config .BlobFeeCap ),
314+ Gas : t .config .GasLimit ,
315+ To : & toAddr ,
316+ Value : uint256 .MustFromBig (txAmount ),
317+ Data : txData ,
318+ }, blobRefs )
319+ if err != nil {
320+ return fmt .Errorf ("cannot build blob tx data: %w" , err )
321+ }
322+
323+ tx , err := txWallet .BuildBlobTx (blobTx )
324+ if err != nil {
325+ return fmt .Errorf ("cannot build blob transaction: %w" , err )
327326 }
328327
329328 walletMgr := t .ctx .Scheduler .GetServices ().WalletManager ()
330329 client := walletMgr .GetClient (clients [transactionIdx % uint64 (len (clients ))])
331330
332- return walletMgr .GetTxPool ().SendTransaction (ctx , txWallet , tx , & spamoor.SendTransactionOptions {
331+ err = walletMgr .GetTxPool ().SendTransaction (ctx , txWallet , tx , & spamoor.SendTransactionOptions {
333332 Client : client ,
334333 Rebroadcast : true ,
335334 OnComplete : completeFn ,
@@ -353,4 +352,10 @@ func (t *Task) generateTransaction(ctx context.Context, transactionIdx uint64, c
353352 logEntry .Infof ("submitted blob transaction %v (nonce: %v, attempt: %v)" , transactionIdx , tx .Nonce (), retry )
354353 },
355354 })
355+ if err != nil {
356+ txWallet .MarkSkippedNonce (tx .Nonce ())
357+ return err
358+ }
359+
360+ return nil
356361}
0 commit comments