Skip to content

Commit

Permalink
Merge pull request #1161 from interlay/tom/fix/calculate-initial-stak…
Browse files Browse the repository at this point in the history
…ing-rewards

fix: use currentBlockNumber when there is no existing stake
  • Loading branch information
tomjeatt authored Apr 27, 2023
2 parents 36878c7 + 942bbc7 commit e8600db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/Staking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ const Staking = (): JSX.Element => {
React.useEffect(() => {
if (!lockTime) return;
if (!currentBlockNumber) return;
if (!stakedAmountAndEndBlock) return;

const lockTimeValue = Number(lockTime);
const extensionTime = stakedAmountAndEndBlock.endBlock + convertWeeksToBlockNumbers(lockTimeValue);
const extensionTime =
(stakedAmountAndEndBlock?.endBlock || currentBlockNumber) + convertWeeksToBlockNumbers(lockTimeValue);

setBlockLockTimeExtension(extensionTime);
}, [currentBlockNumber, lockTime, stakedAmountAndEndBlock]);
Expand Down

2 comments on commit e8600db

@vercel
Copy link

@vercel vercel bot commented on e8600db Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on e8600db Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.