Improve transaction creation
This commit is contained in:
parent
c632e33ffc
commit
96d168d4d4
11
account.go
11
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
|
||||
}
|
||||
|
|
|
@ -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])
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue