Skip to content

Commit

Permalink
fix: fallback to mempool get tip height if wallet stop working
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwbabylonlab committed Dec 15, 2024
1 parent 7f24075 commit 444e959
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-staking",
"version": "0.3.22",
"version": "0.3.23",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
9 changes: 7 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ const Home: React.FC<HomeProps> = () => {
btcWallet!.getBTCTipHeight(),
getGlobalParams(),
]);
let h = height;
if (height === 0) {
h = await btcWallet!.getBTCTipHeight();
}

return {
// The staking parameters are retrieved based on the current height + 1
// so this verification should take this into account.
currentHeight: height,
nextBlockParams: getCurrentGlobalParamsVersion(height + 1, versions),
currentHeight: h,
nextBlockParams: getCurrentGlobalParamsVersion(h + 1, versions),
};
},
refetchInterval: 60000, // 1 minute
Expand Down

0 comments on commit 444e959

Please sign in to comment.