|
|
|
@ -38,6 +38,7 @@ import ( |
|
|
|
|
"github.com/ethereum/go-ethereum/metrics" |
|
|
|
|
"github.com/ethereum/go-ethereum/params" |
|
|
|
|
"github.com/holiman/uint256" |
|
|
|
|
"golang.org/x/exp/maps" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
@ -1717,7 +1718,7 @@ func (a addressesByHeartbeat) Swap(i, j int) { a[i], a[j] = a[j], a[i] } |
|
|
|
|
type accountSet struct { |
|
|
|
|
accounts map[common.Address]struct{} |
|
|
|
|
signer types.Signer |
|
|
|
|
cache *[]common.Address |
|
|
|
|
cache []common.Address |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// newAccountSet creates a new address set with an associated signer for sender
|
|
|
|
@ -1765,20 +1766,14 @@ func (as *accountSet) addTx(tx *types.Transaction) { |
|
|
|
|
// reuse. The returned slice should not be changed!
|
|
|
|
|
func (as *accountSet) flatten() []common.Address { |
|
|
|
|
if as.cache == nil { |
|
|
|
|
accounts := make([]common.Address, 0, len(as.accounts)) |
|
|
|
|
for account := range as.accounts { |
|
|
|
|
accounts = append(accounts, account) |
|
|
|
|
as.cache = maps.Keys(as.accounts) |
|
|
|
|
} |
|
|
|
|
as.cache = &accounts |
|
|
|
|
} |
|
|
|
|
return *as.cache |
|
|
|
|
return as.cache |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// merge adds all addresses from the 'other' set into 'as'.
|
|
|
|
|
func (as *accountSet) merge(other *accountSet) { |
|
|
|
|
for addr := range other.accounts { |
|
|
|
|
as.accounts[addr] = struct{}{} |
|
|
|
|
} |
|
|
|
|
maps.Copy(as.accounts, other.accounts) |
|
|
|
|
as.cache = nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|