use of io.nuls.ledger.service.impl.LedgerCacheService in project nuls by nuls-io.
the class UtxoInput method parse.
@Override
public void parse(NulsByteBuffer byteBuffer) throws NulsException {
index = (int) byteBuffer.readVarInt();
fromHash = byteBuffer.readNulsData(new NulsDigestData());
fromIndex = (int) byteBuffer.readVarInt();
LedgerCacheService ledgerCacheService = LedgerCacheService.getInstance();
UtxoOutput output = ledgerCacheService.getUtxo(this.getKey());
if (output == null) {
UtxoOutputDataService utxoOutputDataService = NulsContext.getServiceBean(UtxoOutputDataService.class);
Map<String, Object> map = new HashMap<>();
map.put("txHash", this.fromHash.getDigestHex());
map.put("outIndex", this.fromIndex);
UtxoOutputPo outputPo = utxoOutputDataService.get(map);
if (outputPo != null) {
output = UtxoTransferTool.toOutput(outputPo);
}
}
from = output;
}
Aggregations