mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
core/types: return list of unique authority addresses in SetCodeAuthorities()
This commit is contained in:
parent
77b28a010f
commit
bcb983693e
1 changed files with 10 additions and 2 deletions
|
|
@ -483,15 +483,23 @@ func (tx *Transaction) SetCodeAuthorizations() []SetCodeAuthorization {
|
|||
return setcodetx.AuthList
|
||||
}
|
||||
|
||||
// SetCodeAuthorities returns a list of each authorization's corresponding authority.
|
||||
// SetCodeAuthorities returns a list of unique authorities from the
|
||||
// authorization list.
|
||||
func (tx *Transaction) SetCodeAuthorities() []common.Address {
|
||||
setcodetx, ok := tx.inner.(*SetCodeTx)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
auths := make([]common.Address, 0, len(setcodetx.AuthList))
|
||||
var (
|
||||
marks = make(map[common.Address]bool)
|
||||
auths = make([]common.Address, 0, len(setcodetx.AuthList))
|
||||
)
|
||||
for _, auth := range setcodetx.AuthList {
|
||||
if addr, err := auth.Authority(); err == nil {
|
||||
if marks[addr] {
|
||||
continue
|
||||
}
|
||||
marks[addr] = true
|
||||
auths = append(auths, addr)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue