mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-10 01:56:37 +00:00
validate that accounts in the BAL are unique
This commit is contained in:
parent
10a4b0917e
commit
1ef2b5d739
1 changed files with 10 additions and 0 deletions
|
|
@ -95,6 +95,16 @@ func (e BlockAccessList) Validate() error {
|
||||||
}) {
|
}) {
|
||||||
return errors.New("block access list accounts not in lexicographic order")
|
return errors.New("block access list accounts not in lexicographic order")
|
||||||
}
|
}
|
||||||
|
// check that the accounts are unique
|
||||||
|
addrs := make(map[common.Address]struct{})
|
||||||
|
for _, acct := range e {
|
||||||
|
addr := acct.Address
|
||||||
|
if _, ok := addrs[addr]; ok {
|
||||||
|
return fmt.Errorf("duplicate account in block access list: %x", addr)
|
||||||
|
}
|
||||||
|
addrs[addr] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
for _, entry := range e {
|
for _, entry := range e {
|
||||||
if err := entry.validate(); err != nil {
|
if err := entry.validate(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue