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

Debug #45

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func SendPingTx(param SendPingTxParam) (string, string, PingResultError) {
latestBlockhashResponse, err := param.Client.GetLatestBlockhashWithConfig(
context.Background(),
client.GetLatestBlockhashConfig{
Commitment: rpc.CommitmentConfirmed,
Commitment: rpc.CommitmentFinalized,
},
)
if err != nil {
Expand Down Expand Up @@ -132,7 +132,7 @@ func SendPingTx(param SendPingTxParam) (string, string, PingResultError) {
context.Background(),
tx,
client.SendTransactionConfig{
SkipPreflight: true,
PreflightCommitment: rpc.CommitmentConfirmed,
},
)
if err != nil {
Expand Down
10 changes: 10 additions & 0 deletions rpcPing.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func Ping(c *client.Client, pType PingType, acct types.Account, config ClusterCo
timer.Add()
confirmedCount++
} else {
startTime := time.Now()
endTime := startTime.Add(5 * time.Second)
txhash, blockhash, pingErr := SendPingTx(SendPingTxParam{
Client: c,
FeePayer: acct,
Expand All @@ -84,7 +86,15 @@ func Ping(c *client.Client, pType PingType, acct types.Account, config ClusterCo
resultErrs = append(resultErrs, string(pingErr))
continue
}
if time.Now().After(endTime) {
resultErrs = append(resultErrs, "Send Ping took over 5 seconds for txhash: "+txhash+" and blockhash: "+blockhash)
}
startTimeConfirmation := time.Now()
endTimeConfirmation := startTimeConfirmation.Add(10 * time.Second)
waitErr := waitConfirmationOrBlockhashInvalid(c, txhash, blockhash)
if time.Now().After(endTimeConfirmation) {
resultErrs = append(resultErrs, "Confirmation took over 10 seconds for txhash: "+txhash+" and blockhash: "+blockhash)
}
timer.TimerStop()
if waitErr.HasError() {
resultErrs = append(resultErrs, string(waitErr))
Expand Down