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