Peers error and supply growth error fixed
This commit is contained in:
parent
70bf81782e
commit
6c79281e8f
@ -758,7 +758,9 @@ export class BlockchainBlockController {
|
|||||||
/// Block Reward that will be assigned after we change from era 5 to era 6.
|
/// Block Reward that will be assigned after we change from era 5 to era 6.
|
||||||
const BASE_REWARD_ERA_6_ONWARDS = 0.15625;
|
const BASE_REWARD_ERA_6_ONWARDS = 0.15625;
|
||||||
/// Compute the total reward generated by each block in a given height.
|
/// Compute the total reward generated by each block in a given height.
|
||||||
if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_1) {
|
if(BlockchainBlockFetchQuery.Height == 0) {
|
||||||
|
BlockchainBlockFetchQuery['BlockReward'] = 0;
|
||||||
|
}else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_1) {
|
||||||
BlockchainBlockFetchQuery['BlockReward'] = 16;
|
BlockchainBlockFetchQuery['BlockReward'] = 16;
|
||||||
} else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_2) {
|
} else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_2) {
|
||||||
BlockchainBlockFetchQuery['BlockReward'] = 8;
|
BlockchainBlockFetchQuery['BlockReward'] = 8;
|
||||||
@ -1867,23 +1869,34 @@ let remaining_height = 0;
|
|||||||
} else {
|
} else {
|
||||||
var timeIntervalQry = "timestamp > current_date - interval '30 days'";
|
var timeIntervalQry = "timestamp > current_date - interval '30 days'";
|
||||||
}
|
}
|
||||||
|
let DAY_HEIGHT = 1440
|
||||||
|
/// Height of the first epic block emission era
|
||||||
|
const BLOCK_ERA_1 = DAY_HEIGHT * 334;
|
||||||
|
/// Height of the second epic block emission era
|
||||||
|
const BLOCK_ERA_2 = BLOCK_ERA_1 + (DAY_HEIGHT * 470);
|
||||||
|
/// Height of the third epic block emission era
|
||||||
|
const BLOCK_ERA_3 = BLOCK_ERA_2 + (DAY_HEIGHT * 601);
|
||||||
|
/// Height of the fourth epic block emission era
|
||||||
|
const BLOCK_ERA_4 = BLOCK_ERA_3 + (DAY_HEIGHT * 800);
|
||||||
|
/// Height of the fifth epic block emission era
|
||||||
|
const BLOCK_ERA_5 = BLOCK_ERA_4 + (DAY_HEIGHT * 1019);
|
||||||
|
/// After the epic block emission era 6, each era will last 4 years (approximately 1460 days)
|
||||||
|
const BLOCK_ERA_6_ONWARDS = DAY_HEIGHT * 1460;
|
||||||
|
/// Block Reward that will be assigned after we change from era 5 to era 6.
|
||||||
|
const BASE_REWARD_ERA_6_ONWARDS = 0.15625;
|
||||||
const BlockchainBlockPerSecondQuery = await getConnection()
|
const BlockchainBlockPerSecondQuery = await getConnection()
|
||||||
.query(
|
.query(
|
||||||
'select x.timestamp, SUM(x.reward) as total_reward_per_day \
|
'select x.timestamp, x.height, SUM(x.reward) as total_reward_per_day \
|
||||||
from (SELECT hash, height, CAST(timestamp AS DATE), \
|
from (SELECT hash, height, CAST(timestamp AS DATE), \
|
||||||
CASE \
|
CASE \
|
||||||
WHEN height <= 1440 THEN 200 \
|
WHEN height <= '+BLOCK_ERA_1+' THEN 16 \
|
||||||
WHEN height <= 2880 THEN 180 \
|
WHEN height <= '+BLOCK_ERA_2+' THEN 8 \
|
||||||
WHEN height <= 4320 THEN 160 \
|
WHEN height <= '+BLOCK_ERA_3+' THEN 4 \
|
||||||
WHEN height <= 5760 THEN 140 \
|
WHEN height <= '+BLOCK_ERA_4+' THEN 2 \
|
||||||
WHEN height <= 7200 THEN 120 \
|
WHEN height <= '+BLOCK_ERA_5+' THEN 1 \
|
||||||
WHEN height <= 8640 THEN 100 \
|
ELSE '+BASE_REWARD_ERA_6_ONWARDS+' / (1 << ((height - ('+BLOCK_ERA_5+'- 1))/'+BLOCK_ERA_6_ONWARDS+'))\
|
||||||
WHEN height <= 10080 THEN 80 \
|
|
||||||
WHEN height <= 11520 THEN 60 \
|
|
||||||
WHEN height <= 12960 THEN 50 \
|
|
||||||
ELSE 25 \
|
|
||||||
END AS reward \
|
END AS reward \
|
||||||
FROM blockchain_block where ' +
|
FROM blockchain_block where height > 0 AND ' +
|
||||||
timeIntervalQry +
|
timeIntervalQry +
|
||||||
') as x group by x.timestamp Order by x.timestamp ASC',
|
') as x group by x.timestamp Order by x.timestamp ASC',
|
||||||
)
|
)
|
||||||
@ -1891,6 +1904,28 @@ let remaining_height = 0;
|
|||||||
next(err_msg);
|
next(err_msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// Compute the total reward generated by each block in a given height.
|
||||||
|
// if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_1) {
|
||||||
|
// BlockchainBlockFetchQuery['BlockReward'] = 16;
|
||||||
|
// } else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_2) {
|
||||||
|
// BlockchainBlockFetchQuery['BlockReward'] = 8;
|
||||||
|
// } else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_3) {
|
||||||
|
// BlockchainBlockFetchQuery['BlockReward'] = 4;
|
||||||
|
// } else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_4) {
|
||||||
|
// BlockchainBlockFetchQuery['BlockReward'] = 2;
|
||||||
|
// } else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_5) {
|
||||||
|
// BlockchainBlockFetchQuery['BlockReward'] = 1;
|
||||||
|
// } else {
|
||||||
|
// // After the era 6, we reduce the block rewards by half each 1460 days.
|
||||||
|
// // Minus 1 to include multiples in the same index
|
||||||
|
// // (i.e changes greater than to greater or equals to)
|
||||||
|
// let height_with_offset = BlockchainBlockFetchQuery.Height - (BLOCK_ERA_5 - 1);
|
||||||
|
// let exp = height_with_offset / BLOCK_ERA_6_ONWARDS;
|
||||||
|
// BlockchainBlockFetchQuery['BlockReward'] = BASE_REWARD_ERA_6_ONWARDS / (1 << exp);
|
||||||
|
// }
|
||||||
|
|
||||||
let date = [],
|
let date = [],
|
||||||
total_reward_per_day = [],
|
total_reward_per_day = [],
|
||||||
addedreward = [],
|
addedreward = [],
|
||||||
|
@ -163,9 +163,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="latest_table mt-3">
|
<div class="latest_table mt-3">
|
||||||
<h2 class="mb-3 chart_heading px-0 d-inline-block">Peers <span *ngIf="peers.length > 0" class="txn_count" >{{
|
<h2 class="mb-3 chart_heading px-0 d-inline-block">Peers
|
||||||
|
<span *ngIf="peers && peers.length > 0" class="txn_count" >{{
|
||||||
peers.length | number
|
peers.length | number
|
||||||
}}</span></h2>
|
}}</span>
|
||||||
|
</h2>
|
||||||
<div class="mobile_table web_hdng">
|
<div class="mobile_table web_hdng">
|
||||||
|
|
||||||
<div class="mobile_table peer_table">
|
<div class="mobile_table peer_table">
|
||||||
|
@ -99,7 +99,11 @@ export class LatestblocksComponent implements OnInit {
|
|||||||
this.chartService.apiGetRequest('','/blockchain_kernel/getpeers').subscribe(
|
this.chartService.apiGetRequest('','/blockchain_kernel/getpeers').subscribe(
|
||||||
res => {
|
res => {
|
||||||
if (res['status'] == 200) {
|
if (res['status'] == 200) {
|
||||||
this.peers = res.response.dataJson;
|
let json = res.response.dataJson;
|
||||||
|
if(json && json.length > 0){
|
||||||
|
localStorage.setItem('peersJson',JSON.stringify(json));
|
||||||
|
}
|
||||||
|
this.peers = JSON.parse(localStorage.getItem('peersJson'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => {},
|
error => {},
|
||||||
|
Loading…
Reference in New Issue
Block a user