Skip to content

Commit

Permalink
Added a retry mechanism to getRegisteredStealthKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
jferas committed Mar 5, 2024
1 parent 7efda1b commit f490de1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions frontend/src/store/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,11 +613,16 @@ const hasSetPublicKeysLegacy = async (name: string, provider: Provider) => {

// Helper method to check if user has registered public keys in the StealthKeyRegistry
async function getRegisteredStealthKeys(account: string, provider: Provider) {
try {
const stealthPubKeys = await utils.lookupRecipient(account, provider); // throws if no keys found
return stealthPubKeys;
} catch (err) {
window.logger.warn(err);
return null;
let retryCounter = 0;
while (retryCounter < 3) {
try {
console.log(`getting stealth keys for ${account}, try ${retryCounter + 1} of 3`);
const stealthPubKeys = await utils.lookupRecipient(account, provider); // throws if no keys found
return stealthPubKeys;
} catch (err) {
window.logger.warn(err);
retryCounter++;
}
}
return null;
}

0 comments on commit f490de1

Please sign in to comment.