Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Commit 6ac7643

Browse files
committed
Add debug and use finalized commit level
1 parent 8991bc7 commit 6ac7643

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Transfer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func SendPingTx(param SendPingTxParam) (string, string, PingResultError) {
8686
latestBlockhashResponse, err := param.Client.GetLatestBlockhashWithConfig(
8787
context.Background(),
8888
client.GetLatestBlockhashConfig{
89-
Commitment: rpc.CommitmentConfirmed,
89+
Commitment: rpc.CommitmentFinalized,
9090
},
9191
)
9292
if err != nil {
@@ -132,7 +132,7 @@ func SendPingTx(param SendPingTxParam) (string, string, PingResultError) {
132132
context.Background(),
133133
tx,
134134
client.SendTransactionConfig{
135-
SkipPreflight: true,
135+
PreflightCommitment: rpc.CommitmentFinalized,
136136
},
137137
)
138138
if err != nil {
@@ -231,7 +231,7 @@ func isBlockhashValid(c *client.Client, ctx context.Context, blockhash string) (
231231
ctx,
232232
blockhash,
233233
client.IsBlockhashValidConfig{
234-
Commitment: rpc.CommitmentConfirmed,
234+
Commitment: rpc.CommitmentFinalized,
235235
},
236236
)
237237
if err != nil {

rpcPing.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,18 @@ func Ping(c *client.Client, pType PingType, acct types.Account, config ClusterCo
6969
timer.Add()
7070
confirmedCount++
7171
} else {
72+
startTime := time.Now()
73+
endTime := startTime.Add(5 * time.Second)
7274
txhash, blockhash, pingErr := SendPingTx(SendPingTxParam{
7375
Client: c,
7476
FeePayer: acct,
7577
RequestComputeUnits: config.RequestUnits,
7678
ComputeUnitPrice: computeUnitPrice,
7779
ReceiverPubkey: config.Receiver,
7880
})
81+
if time.Now().After(endTime) {
82+
resultErrs = append(resultErrs, "Send Ping took over 5 seconds")
83+
}
7984
if pingErr.HasError() {
8085
timer.TimerStop()
8186
if !pingErr.IsInErrorList(PingTakeTimeErrExpectionList) {
@@ -84,7 +89,12 @@ func Ping(c *client.Client, pType PingType, acct types.Account, config ClusterCo
8489
resultErrs = append(resultErrs, string(pingErr))
8590
continue
8691
}
92+
startTimeConfirmation := time.Now()
93+
endTimeConfirmation := startTimeConfirmation.Add(10 * time.Second)
8794
waitErr := waitConfirmationOrBlockhashInvalid(c, txhash, blockhash)
95+
if time.Now().After(endTimeConfirmation) {
96+
resultErrs = append(resultErrs, "Confirmation took over 10 seconds")
97+
}
8898
timer.TimerStop()
8999
if waitErr.HasError() {
90100
resultErrs = append(resultErrs, string(waitErr))

0 commit comments

Comments
 (0)