use of com.jd.blockchain.ledger.core.DataAccount in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getDataEntriesTotalCount.
@RequestMapping(method = RequestMethod.GET, path = GET_KV_COUNT)
@Override
public long getDataEntriesTotalCount(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @PathVariable(name = "address") String address) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
DataAccountSet dataAccountSet = ledger.getDataAccountSet(block);
DataAccount dataAccount = dataAccountSet.getAccount(Bytes.fromBase58(address));
if (dataAccount == null) {
return 0;
}
return dataAccount.getDataset().getDataCount();
}
Aggregations