diff --git a/account.go b/account.go index 0e2c05c..6c0b7b8 100644 --- a/account.go +++ b/account.go @@ -73,14 +73,11 @@ func NewAccountMeta( } func (a *AccountMeta) less(act *AccountMeta) bool { - if a.IsSigner && !act.IsSigner { - return true - } else if !a.IsSigner && act.IsSigner { - return false + if a.IsSigner != act.IsSigner { + return a.IsSigner } - - if a.IsWritable { - return true + if a.IsWritable != act.IsWritable { + return a.IsWritable } return false } diff --git a/transaction.go b/transaction.go index c05dff7..99ffc74 100644 --- a/transaction.go +++ b/transaction.go @@ -127,7 +127,7 @@ func NewTransaction(instructions []Instruction, recentBlockHash Hash, opts ...Tr } // Sort. Prioritizing first by signer, then by writable - sort.Slice(accounts, func(i, j int) bool { + sort.SliceStable(accounts, func(i, j int) bool { return accounts[i].less(accounts[j]) })