本文整理了Java中io.nuls.kernel.model.Transaction.verify()
方法的一些代码示例,展示了Transaction.verify()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.verify()
方法的具体详情如下:
包路径:io.nuls.kernel.model.Transaction
类名称:Transaction
方法名:verify
暂无
代码示例来源:origin: nuls-io/nuls
private Result verifyTransaction(Transaction tx, Map<String, Coin> toMaps, Set<String> fromSet) {
Result result = tx.verify();
if (result.isFailed()) {
return result;
}
result = ledgerService.verifyCoinData(tx, toMaps, fromSet);
if (result.isFailed()) {
return result;
}
return Result.getSuccess();
}
}
代码示例来源:origin: nuls-io/nuls
@Override
public Boolean call() throws Exception {
ValidateResult verify = tx.verify();
/** ************************************************************/
if (verify.isFailed()) {
Log.error(JSONUtils.obj2json(verify.getErrorCode()));
}
/** ************************************************************/
boolean result = verify.isSuccess();
return result;
}
});
代码示例来源:origin: nuls-io/nuls
@Override
public Result<Integer> verifyAndSaveUnconfirmedTransaction(Transaction tx) {
saveLock.lock();
try {
ValidateResult result = tx.verify();
if (result.isFailed()) {
return result;
}
if (!tx.isSystemTx()) {
Map<String, Coin> toCoinMap = addToCoinMap(tx);
if (usedTxSets == null) {
initUsedTxSets();
}
result = this.ledgerService.verifyCoinData(tx, toCoinMap, usedTxSets);
if (result.isFailed()) {
Log.info("verifyCoinData failed : " + result.getMsg());
return result;
}
}
Result<Integer> res = saveUnconfirmedTransaction(tx);
return res;
} finally {
saveLock.unlock();
}
}
代码示例来源:origin: nuls-io/nuls
@POST
@Path("/transaction/validate")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "验证交易是否正确", notes = "result.data: resultJson 返回验证结果")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "success")
})
public RpcClientResult validate(@ApiParam(name = "form", value = "验证交易是否正确", required = true) BroadHexTxForm form) {
if (StringUtils.isBlank(form.getTxHex())) {
return Result.getFailed(AccountErrorCode.PARAMETER_ERROR).toRpcClientResult();
}
try {
byte[] data = Hex.decode(form.getTxHex());
Transaction tx = TransactionManager.getInstance(new NulsByteBuffer(data));
ValidateResult validateResult = tx.verify();
if (validateResult.isFailed()) {
return Result.getFailed(validateResult.getErrorCode()).toRpcClientResult();
}
validateResult = this.ledgerService.verifyCoinData(tx, new HashMap<>(), new HashSet<>());
if (validateResult.isFailed()) {
return Result.getFailed(validateResult.getErrorCode()).toRpcClientResult();
}
Result result = Result.getSuccess();
return result.toRpcClientResult();
} catch (Exception e) {
Log.error(e);
return Result.getFailed(LedgerErrorCode.DATA_PARSE_ERROR).toRpcClientResult();
}
}
代码示例来源:origin: nuls-io/nuls
@POST
@Path("/transaction/valiTransaction")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "验证交易是否正确", notes = "result.data: resultJson 返回验证结果")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "success")
})
public RpcClientResult valiTransaction(@ApiParam(name = "form", value = "验证交易是否正确", required = true) BroadHexTxForm form) {
if (StringUtils.isBlank(form.getTxHex())) {
return Result.getFailed(AccountErrorCode.PARAMETER_ERROR).toRpcClientResult();
}
try {
byte[] data = Hex.decode(form.getTxHex());
Transaction tx = TransactionManager.getInstance(new NulsByteBuffer(data));
ValidateResult validateResult = tx.verify();
if (validateResult.isFailed()) {
return Result.getFailed(validateResult.getErrorCode()).toRpcClientResult();
}
validateResult = this.ledgerService.verifyCoinData(tx, new HashMap<>(), new HashSet<>());
if (validateResult.isFailed() && !validateResult.getErrorCode().equals(TransactionErrorCode.ORPHAN_TX)) {
return Result.getFailed(validateResult.getErrorCode()).toRpcClientResult();
}
Result result = Result.getSuccess();
return result.toRpcClientResult();
} catch (Exception e) {
Log.error(e);
return Result.getFailed(LedgerErrorCode.DATA_PARSE_ERROR).toRpcClientResult();
}
}
代码示例来源:origin: nuls-io/nuls
private boolean processTx(Transaction tx, boolean isOrphanTx) {
try {
Result result = tx.verify();
if (result.isFailed()) {
return false;
代码示例来源:origin: nuls-io/nuls
ValidateResult result = tx.verify();
if (result.isSuccess()) {
result = ledgerService.verifyCoinData(tx, toMaps, fromSet, bestHeight);
内容来源于网络,如有侵权,请联系作者删除!