Skip to content

Commit

Permalink
Sort signers before adding to the multi-signing transaction. (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitryhil committed Sep 7, 2023
1 parent 7739c2f commit ff021a3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion data/signing.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package data

import "github.com/rubblelabs/ripple/crypto"
import (
"sort"

"github.com/rubblelabs/ripple/crypto"
)

func Sign(s Signable, key crypto.Key, sequence *uint32) error {
s.InitialiseForSigning()
Expand Down Expand Up @@ -52,6 +56,9 @@ func MultiSign(s MultiSignable, key crypto.Key, sequence *uint32, account Accoun
}

func SetSigners(s MultiSignable, signers ...Signer) error {
sort.Slice(signers, func(i, j int) bool {
return signers[i].Signer.Account.Less(signers[j].Signer.Account)
})
s.SetSigners(signers)

hash, _, err := Raw(s)
Expand Down

0 comments on commit ff021a3

Please sign in to comment.