From bcb983693e93131a3b3489dc71cdd3771d4f3721 Mon Sep 17 00:00:00 2001 From: lightclient Date: Wed, 26 Feb 2025 09:52:59 -0700 Subject: [PATCH] core/types: return list of unique authority addresses in SetCodeAuthorities() --- core/types/transaction.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/types/transaction.go b/core/types/transaction.go index 7df13e04bb..4e48248b4a 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -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) } }