commit_id search
This commit is contained in:
parent
56f951b032
commit
9cf293fa0c
@ -711,6 +711,35 @@ export class BlockchainBlockController {
|
|||||||
next: NextFunction,
|
next: NextFunction,
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
|
var BlockchainOutputFetchQuery = await getConnection(Global.network).getRepository(
|
||||||
|
BlockchainOutput,
|
||||||
|
).findOne({
|
||||||
|
select: [
|
||||||
|
'BlockId'
|
||||||
|
],
|
||||||
|
where: { Commit : request.params.hash },
|
||||||
|
});
|
||||||
|
|
||||||
|
if(BlockchainOutputFetchQuery){
|
||||||
|
var BlockchainBlockFetchQuery = await getConnection(Global.network).getRepository(
|
||||||
|
BlockchainBlock,
|
||||||
|
).findOne({
|
||||||
|
select: [
|
||||||
|
'Hash',
|
||||||
|
'Height',
|
||||||
|
'Timestamp',
|
||||||
|
'TotalDifficultyCuckaroo',
|
||||||
|
'TotalDifficultyCuckatoo',
|
||||||
|
'TotalDifficultyProgpow',
|
||||||
|
'TotalDifficultyRandomx',
|
||||||
|
'PreviousId',
|
||||||
|
'EdgeBits',
|
||||||
|
'SecondaryScaling',
|
||||||
|
'Proof',
|
||||||
|
],
|
||||||
|
where: { Hash: BlockchainOutputFetchQuery.BlockId },
|
||||||
|
});
|
||||||
|
}else{
|
||||||
var BlockchainBlockFetchQuery = await getConnection(Global.network).getRepository(
|
var BlockchainBlockFetchQuery = await getConnection(Global.network).getRepository(
|
||||||
BlockchainBlock,
|
BlockchainBlock,
|
||||||
).findOne({
|
).findOne({
|
||||||
@ -729,6 +758,19 @@ export class BlockchainBlockController {
|
|||||||
],
|
],
|
||||||
where: { Hash: request.params.hash },
|
where: { Hash: request.params.hash },
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let paramVal = request.params.hash;
|
let paramVal = request.params.hash;
|
||||||
if (
|
if (
|
||||||
!BlockchainBlockFetchQuery &&
|
!BlockchainBlockFetchQuery &&
|
||||||
@ -768,7 +810,7 @@ export class BlockchainBlockController {
|
|||||||
const BlockchainBlockOutputFetchQuery = await getConnection(Global.network).getRepository(
|
const BlockchainBlockOutputFetchQuery = await getConnection(Global.network).getRepository(
|
||||||
BlockchainOutput,
|
BlockchainOutput,
|
||||||
).find({
|
).find({
|
||||||
select: ['OutputType', 'Commit', 'Spent'],
|
select: ['OutputType', 'Commit', 'Spent', 'MerkleProof', 'MmrIndex', 'ProofHash', 'Proof'],
|
||||||
where: { BlockId: BlockchainBlockFetchQuery.Hash },
|
where: { BlockId: BlockchainBlockFetchQuery.Hash },
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -892,6 +934,8 @@ export class BlockchainBlockController {
|
|||||||
let arr = balance.match(/.{1,6}/g);
|
let arr = balance.match(/.{1,6}/g);
|
||||||
BlockchainBlockFetchQuery['hasharray'] = arr.map(i => '#' + i);
|
BlockchainBlockFetchQuery['hasharray'] = arr.map(i => '#' + i);
|
||||||
|
|
||||||
|
var viewType = BlockchainOutputFetchQuery ? 'Commit' : 'HashHeight';
|
||||||
|
|
||||||
BlockchainBlockFetchQuery
|
BlockchainBlockFetchQuery
|
||||||
? response.status(200).json({
|
? response.status(200).json({
|
||||||
status: 200,
|
status: 200,
|
||||||
@ -902,6 +946,7 @@ export class BlockchainBlockController {
|
|||||||
BlockchainBlockInputFetchQuery: BlockchainBlockInputFetchQuery,
|
BlockchainBlockInputFetchQuery: BlockchainBlockInputFetchQuery,
|
||||||
BlockchainBlockOutputFetchQuery: BlockchainBlockOutputFetchQuery,
|
BlockchainBlockOutputFetchQuery: BlockchainBlockOutputFetchQuery,
|
||||||
BlockchainBlockKernalFetchQuery: BlockchainBlockKernalFetchQuery,
|
BlockchainBlockKernalFetchQuery: BlockchainBlockKernalFetchQuery,
|
||||||
|
viewType: viewType
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
: next(new NoDataFoundException());
|
: next(new NoDataFoundException());
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<div class="view_content py-4">
|
<div class="view_content py-4">
|
||||||
<div *ngIf="hasdata" class="container">
|
<div *ngIf="hasdata" class="container">
|
||||||
|
<div *ngIf="hashdata.viewType == 'HashHeight' " >
|
||||||
<div *ngIf="TimeArr" class="box_shadow_large detail_div p-3 mb-4">
|
<div *ngIf="TimeArr" class="box_shadow_large detail_div p-3 mb-4">
|
||||||
<!-- <h1 class="test_msg align-middle mb-0 d-inline-block mr-3 pl-3">{{'home.HEADER_TEXT' | translate}}</h1> -->
|
<!-- <h1 class="test_msg align-middle mb-0 d-inline-block mr-3 pl-3">{{'home.HEADER_TEXT' | translate}}</h1> -->
|
||||||
<!-- <h1 class="test_msg align-middle mb-0 float-right d-inline-block pl-3">{{'home.COUNTDOWN' | translate}}
|
<!-- <h1 class="test_msg align-middle mb-0 float-right d-inline-block pl-3">{{'home.COUNTDOWN' | translate}}
|
||||||
@ -285,6 +286,59 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="hashdata.viewType == 'Commit'" >
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<h3> Output Commit <span style="font-size:15px"></span></h3>
|
||||||
|
|
||||||
|
<table class="table table-horizontal-bordered table-hover">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Created at block </td>
|
||||||
|
<td>{{ hashdata.BlockchainBlockFetchQuery.Height }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Created At </td>
|
||||||
|
<td>{{ hashdata.BlockchainBlockFetchQuery.Timestamp }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Output Type</td>
|
||||||
|
<td>{{ hashdata.BlockchainBlockOutputFetchQuery[0].OutputType }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Proof</td>
|
||||||
|
<td>{{ hashdata.BlockchainBlockOutputFetchQuery[0].Proof }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Proof hash</td>
|
||||||
|
<td>{{ hashdata.BlockchainBlockOutputFetchQuery[0].ProofHash }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Merkle Proof</td>
|
||||||
|
<td>{{ hashdata.BlockchainBlockOutputFetchQuery[0].MerkleProof }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>MMR Index</td>
|
||||||
|
<td>{{ hashdata.BlockchainBlockOutputFetchQuery[0].MmrIndex }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div *ngIf="hashdata.BlockchainBlockOutputFetchQuery[0].Proof == false" class="alert alert-success" role="alert">
|
||||||
|
The output commit was not spent.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!hasdata" class="container">
|
<div *ngIf="!hasdata" class="container">
|
||||||
|
Loading…
Reference in New Issue
Block a user