mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-14 07:53:47 +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
|
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 {
|
func (tx *Transaction) SetCodeAuthorities() []common.Address {
|
||||||
setcodetx, ok := tx.inner.(*SetCodeTx)
|
setcodetx, ok := tx.inner.(*SetCodeTx)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
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 {
|
for _, auth := range setcodetx.AuthList {
|
||||||
if addr, err := auth.Authority(); err == nil {
|
if addr, err := auth.Authority(); err == nil {
|
||||||
|
if marks[addr] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
marks[addr] = true
|
||||||
auths = append(auths, addr)
|
auths = append(auths, addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue