Use calculated block subsidy instead of static.

This commit is contained in:
Simon Lindh 2019-11-01 18:04:18 +08:00
parent fc6badb886
commit 7344c518d3
2 changed files with 8 additions and 1 deletions

View File

@ -21,7 +21,7 @@
</tr>
<tr>
<th>Total fees:</th>
<td>{{ (block.fees - 12.5) | number: '1.2-2' }} BTC <span *ngIf="conversions">(<span class="green-color">{{ conversions.USD * (block.fees - 12.5) | currency:'USD':'symbol':'1.0-0' }}</span>)</span></td>
<td>{{ (block.fees - blockSubsidy) | number: '1.2-2' }} BTC <span *ngIf="conversions">(<span class="green-color">{{ conversions.USD * (block.fees - blockSubsidy) | currency:'USD':'symbol':'1.0-0' }}</span>)</span></td>
<th>Block reward + fees:</th>
<td>{{ block.fees | number: '1.2-2' }} BTC <span *ngIf="conversions">(<span class="green-color">{{ conversions.USD * block.fees | currency:'USD':'symbol':'1.0-0' }}</span>)</span></td>
</tr>

View File

@ -10,6 +10,7 @@ import { MemPoolService } from '../../services/mem-pool.service';
})
export class BlockModalComponent implements OnInit {
@Input() block: IBlock;
blockSubsidy = 50;
conversions: any;
@ -23,5 +24,11 @@ export class BlockModalComponent implements OnInit {
.subscribe((conversions) => {
this.conversions = conversions;
});
let halvenings = Math.floor(this.block.height / 210000);
while (halvenings > 0) {
this.blockSubsidy = this.blockSubsidy / 2;
halvenings--;
}
}
}