Update chain.go

This commit is contained in:
Felix Lange 2025-01-10 14:15:04 +01:00 committed by GitHub
parent a487d74971
commit 849366bea4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,6 +40,7 @@ import (
"github.com/ethereum/go-ethereum/eth/protocols/eth"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"golang.org/x/exp/maps"
)
// Chain is a lightweight blockchain-like store which can read a hivechain
@ -165,7 +166,7 @@ func (c *Chain) RootAt(height int) common.Hash {
// GetSender returns the address associated with account at the index in the
// pre-funded accounts list.
func (c *Chain) GetSender(idx int) (common.Address, uint64) {
accounts := slices.Clone(c.senders)
accounts := maps.Keys(c.senders)
slices.SortFunc(accounts, commmon.Address.Cmp)
addr := accounts[idx]
return addr, c.senders[addr].Nonce