Skip to content

Commit

Permalink
fix(icp): self validator addition
Browse files Browse the repository at this point in the history
  • Loading branch information
imsk17 committed Aug 25, 2024
1 parent bca5b9a commit f312582
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/handler/icp/utils/addSelfAsValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default async function addSelfAsValidator(
async function getStakingSignatureCount() {
return Number(await bridge.get_validator_count());
}
const newV = publicKey;
const newV = `${identity.getPrincipal()},${publicKey}`;
let validatorsCount = await getStakingSignatureCount();
let signatureCount = Number(await storage.getStakingSignaturesCount(newV));

Expand All @@ -61,15 +61,23 @@ export default async function addSelfAsValidator(
};
},
);
console.log(
signatures.map((e) => {
return {
signature: e.signature,
signer: e.signerAddress,
};
}),
);

await bridge.add_validator(
{
principal: identity.getPrincipal(),
public_key: newV,
public_key: publicKey,
},
signatures.map((e) => {
return {
signature: e.signature,
signature: e.signature.replace("0x", ""),
signer: e.signerAddress,
};
}),
Expand Down
2 changes: 1 addition & 1 deletion src/handler/icp/utils/listenForLockEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default async function listenForLockEvents(
const latestBlockNumber = Number(latestBlockNumberResponse);

if (latestBlockNumber <= lastBlock) {
logger.info(`0 TXs since Last Nonce: ${lastBlock}. Awaiting 10s`);
logger.trace(`0 TXs since Last Nonce: ${lastBlock}. Awaiting 10s`);
await setTimeout(10000);
continue;
}
Expand Down

0 comments on commit f312582

Please sign in to comment.