Skip to content

Commit

Permalink
fix: disable the staking form when reached height cap (#195)
Browse files Browse the repository at this point in the history
* fix: disable the staking form when reached height cap
  • Loading branch information
jrwbabylonlab authored Oct 3, 2024
1 parent b9f0ae1 commit aac3a6f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 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.3",
"version": "0.3.4",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
6 changes: 2 additions & 4 deletions src/app/components/Staking/Staking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,12 @@ export const Staking: React.FC<StakingProps> = ({
return;
}
const nextBlockHeight = btcHeight + 1;
const { stakingCapHeight, stakingCapSat, confirmationDepth } =
paramWithCtx.currentVersion;
const { stakingCapHeight, stakingCapSat } = paramWithCtx.currentVersion;
// Use height based cap than value based cap if it is set
if (stakingCapHeight) {
setOverflow({
isHeightCap: true,
overTheCapRange:
nextBlockHeight >= stakingCapHeight + confirmationDepth,
overTheCapRange: nextBlockHeight > stakingCapHeight,
/*
When btc height is approching the staking cap height,
there is higher chance of overflow due to tx not being included in the next few blocks on time
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/Stats/Stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ const buildStakingCapSection = (
if (isApprochingNextVersion && nextVersion) {
return buildNextCapText(coinName, btcHeight, nextVersion);
}
const { stakingCapHeight, stakingCapSat, confirmationDepth } = currentVersion;
const { stakingCapHeight, stakingCapSat } = currentVersion;
if (stakingCapHeight) {
const numOfBlockLeft = stakingCapHeight + confirmationDepth - btcHeight - 1;
const numOfBlockLeft = stakingCapHeight - btcHeight;
return {
title: "Staking Window",
value:
Expand Down

0 comments on commit aac3a6f

Please sign in to comment.