Skip to content

Commit

Permalink
rpc server retries transaction conflict when send raw transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricfung committed Dec 30, 2024
1 parent faaf1c7 commit d03316a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rpc/internal/server/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"strconv"
"strings"

"github.com/MixinNetwork/mixin/common"
"github.com/MixinNetwork/mixin/crypto"
Expand Down Expand Up @@ -41,7 +42,16 @@ func queueTransaction(node *kernel.Node, params []any) (string, error) {
if err != nil {
return "", err
}
return node.QueueTransaction(ver)
for {
hash, err := node.QueueTransaction(ver)
if err == nil {
return hash, nil
}
if strings.Contains(err.Error(), "Transaction Conflict") {
continue
}
return hash, err
}
}

func getTransaction(store storage.Store, params []any) (map[string]any, error) {
Expand Down

0 comments on commit d03316a

Please sign in to comment.