onflow/hybrid-custody

[BUG] Duplicate function can be removed

sisyphusSmiling opened this issue · 1 comments

Description

In contracts/HybridCustody.cdc:279, the getAddresses() function performs the same action as getChildAddresses(). This is inefficient because calling both functions returns the same functionality and result.

pub fun getAddresses(): [Address] {
    return self.accounts.keys
}
pub fun getChildAddresses(): [Address] {
    return self.accounts.keys
}

Recommendation

We recommend removing the unused function.

Looks like pub fun getAddresses() is a remnant before we had owned account implemented. I think we should remove that one since we have these two methods that go along each other:

        pub fun getChildAddresses(): [Address] {
            return self.accounts.keys
        }

        pub fun getOwnedAddresses(): [Address] {
            return self.ownedAccounts.keys
        }