steem-python icon indicating copy to clipboard operation
steem-python copied to clipboard

[steem.wallet] get_key_references is not a reliable way to reverse lookup account names

Open Netherdrake opened this issue 7 years ago • 0 comments

The plugin seems to be unreliable. Furthermore, multiple accounts could share the same keys.

Code in question:

    def getAccountFromPublicKey(self, pub):
        """ Obtain account name from public key
        """
        # FIXME, this only returns the first associated key.
        # If the key is used by multiple accounts, this
        # will surely lead to undesired behavior
        names = self.steemd.exec('get_key_references', [pub], api="account_by_key_api")[0]
        if not names:
            return None
        else:
            return names[0]

Potential Solution: One way to solve this would be to ask users for the username of the account/private key are are importing. This is how Vessel does it.

Netherdrake avatar Jun 04 '17 01:06 Netherdrake