diff --git a/apis/candidates.js b/apis/candidates.js
index 3d118c3f..c9c4cabd 100644
--- a/apis/candidates.js
+++ b/apis/candidates.js
@@ -630,6 +630,11 @@ router.get('/:candidate/:owner/getRewards', [
const candidate = req.params.candidate
const owner = req.params.owner
+
+ const latestBlockNumber = await web3.eth.getBlockNumber()
+ const latestCheckpoint = latestBlockNumber - (latestBlockNumber % parseInt(config.get('blockchain.epoch')))
+ const currentEpoch = (parseInt(latestCheckpoint / config.get('blockchain.epoch')) + 1).toString()
+
let limit = (req.query.limit) ? parseInt(req.query.limit) : 100
const page = parseInt(req.query.page) || 1
let skip
@@ -670,6 +675,10 @@ router.get('/:candidate/:owner/getRewards', [
if (!r.reward) {
r.rewardTime = mn.epochCreatedAt || ''
}
+ if (currentEpoch - r.epoch < 2) {
+ r.masternodeReward = '-'
+ r.signNumber = '-'
+ }
return r
})
}
diff --git a/app/components/candidates/View.vue b/app/components/candidates/View.vue
index 2707ef49..5be822ca 100644
--- a/app/components/candidates/View.vue
+++ b/app/components/candidates/View.vue
@@ -262,7 +262,8 @@
- {{ formatCurrencySymbol(formatNumber(data.item.reward)) }}
+ {{ !isNaN(data.item.reward)
+ ? formatCurrencySymbol(formatNumber(data.item.reward)) : data.item.reward }}
{
+ const reward = !isNaN(r.masternodeReward || 0)
+ ? new BigNumber(r.masternodeReward || 0).toFixed(6) : r.masternodeReward
items.push({
epoch: r.epoch,
- signNumber: r.signNumber || 0,
- reward: new BigNumber(r.masternodeReward || 0).toFixed(6),
+ signNumber: r.signNumber ? r.signNumber : 0,
+ reward: reward,
createdAt: r.rewardTime ? moment(r.rewardTime).fromNow() : 'N/A',
dateTooltip: moment(r.rewardTime).format('lll'),
status: r.status