Update chain.go

This commit is contained in:
Felix Lange 2025-01-10 13:47:37 +01:00 committed by GitHub
parent f519111a5d
commit a487d74971
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -165,13 +165,8 @@ func (c *Chain) RootAt(height int) common.Hash {
// GetSender returns the address associated with account at the index in the // GetSender returns the address associated with account at the index in the
// pre-funded accounts list. // pre-funded accounts list.
func (c *Chain) GetSender(idx int) (common.Address, uint64) { func (c *Chain) GetSender(idx int) (common.Address, uint64) {
accounts := make([]common.Address, 0, len(c.senders)) accounts := slices.Clone(c.senders)
for addr := range c.senders { slices.SortFunc(accounts, commmon.Address.Cmp)
accounts = append(accounts, addr)
}
slices.SortFunc(accounts, func(a, b common.Address) int {
return bytes.Compare(a[:], b[:])
})
addr := accounts[idx] addr := accounts[idx]
return addr, c.senders[addr].Nonce return addr, c.senders[addr].Nonce
} }