Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.

Commit 968344a

Browse files
committed
use uuid in sender
1 parent d6f6ad5 commit 968344a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ require (
8181
github.com/google/gofuzz v1.2.0 // indirect
8282
github.com/google/gopacket v1.1.19 // indirect
8383
github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect
84-
github.com/google/uuid v1.3.0 // indirect
84+
github.com/google/uuid v1.6.0 // indirect
8585
github.com/gorilla/mux v1.8.0 // indirect
8686
github.com/gorilla/websocket v1.5.0 // indirect
8787
github.com/grpc-ecosystem/grpc-gateway/v2 v2.0.1 // indirect

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
444444
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
445445
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
446446
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
447+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
448+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
447449
github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY=
448450
github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg=
449451
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=

internal/sender/sender.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import (
88
"os"
99
"strings"
1010
"sync"
11-
"sync/atomic"
1211
"time"
1312

1413
"github.com/ethereum/go-ethereum/accounts/abi/bind"
1514
"github.com/ethereum/go-ethereum/common"
1615
"github.com/ethereum/go-ethereum/core/types"
1716
"github.com/ethereum/go-ethereum/log"
1817
cmap "github.com/orcaman/concurrent-map/v2"
18+
"github.com/pborman/uuid"
1919

2020
"github.com/taikoxyz/taiko-client/pkg/rpc"
2121
)
@@ -61,7 +61,6 @@ type Sender struct {
6161
ChainID *big.Int
6262
Opts *bind.TransactOpts
6363

64-
globalTxID uint64
6564
unconfirmedTxs cmap.ConcurrentMap[string, *TxConfirm] //uint64]*TxConfirm
6665
txConfirmCh cmap.ConcurrentMap[string, chan *TxConfirm]
6766

@@ -164,7 +163,7 @@ func (s *Sender) SendTransaction(tx *types.Transaction) (string, error) {
164163
if err != nil {
165164
return "", err
166165
}
167-
txID := fmt.Sprint(atomic.AddUint64(&s.globalTxID, 1))
166+
txID := uuid.New()
168167
confirmTx := &TxConfirm{
169168
TxID: txID,
170169
baseTx: txData,

0 commit comments

Comments
 (0)