use of com.jd.blockchain.ledger.core.TransactionSet in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getTransactionCount.
@RequestMapping(method = RequestMethod.GET, path = GET_TRANSACTION_COUNT_ON_BLOCK_HASH)
@Override
public long getTransactionCount(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @PathVariable(name = "blockHash") HashDigest blockHash) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getBlock(blockHash);
if (null == block) {
return 0;
}
TransactionSet txSet = ledger.getTransactionSet(block);
return txSet.getTotalCount();
}
use of com.jd.blockchain.ledger.core.TransactionSet in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getTransactionStateByContentHash.
@RequestMapping(method = RequestMethod.GET, path = GET_TRANSACTION_STATE)
@Override
public TransactionState getTransactionStateByContentHash(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @PathVariable(name = "contentHash") HashDigest contentHash) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
TransactionSet txset = ledger.getTransactionSet(block);
return txset.getState(contentHash);
}
Aggregations