common: improve variable names for ExtractAddressFromBytes(), close XFN-27 (#1726)

This commit is contained in:
Daniel Liu 2025-11-15 19:18:01 +08:00 committed by benjamin202410
parent 092810a142
commit f3603d6e13

View file

@ -400,15 +400,15 @@ func ExtractAddressToBytes(penalties []Address) []byte {
return data return data
} }
func ExtractAddressFromBytes(bytePenalties []byte) []Address { func ExtractAddressFromBytes(rawBytes []byte) []Address {
if len(bytePenalties) < AddressLength { if len(rawBytes) < AddressLength {
return []Address{} return []Address{}
} }
penalties := make([]Address, len(bytePenalties)/AddressLength) addresses := make([]Address, len(rawBytes)/AddressLength)
for i := 0; i < len(penalties); i++ { for i := 0; i < len(addresses); i++ {
copy(penalties[i][:], bytePenalties[i*AddressLength:]) copy(addresses[i][:], rawBytes[i*AddressLength:])
} }
return penalties return addresses
} }
// AddressEIP55 is an alias of Address with a customized json marshaller // AddressEIP55 is an alias of Address with a customized json marshaller