From 3c4c33bb1bcc4ce4fa9a48aeff94160733b6586a Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Tue, 30 Nov 2021 17:17:55 +0800 Subject: [PATCH] optimize verifykey --- src/main/java/org/bdware/sc/ContractManager.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bdware/sc/ContractManager.java b/src/main/java/org/bdware/sc/ContractManager.java index 6a09641..4ba4203 100644 --- a/src/main/java/org/bdware/sc/ContractManager.java +++ b/src/main/java/org/bdware/sc/ContractManager.java @@ -1295,13 +1295,19 @@ public class ContractManager { long start = System.currentTimeMillis(); // 9000 - if (client.contractMeta.sigRequired) { if (!request.verifySignature()) { cr = new ContractResult(Status.Error, new JsonPrimitive("sign verified failed")); rcb.onResult(JsonUtil.parseObjectAsJsonObject(cr)); return; } + } else { + if (request.getPublicKey() != null) { + if (!request.verifySignature()) { + request.setPublicKey(null); + request.setRequester(null); + } + } } client.times++; client.contractStatus = ContractStatus.Executing; @@ -1358,6 +1364,13 @@ public class ContractManager { cr = new ContractResult(Status.Error, new JsonPrimitive("sign verified failed")); return JsonUtil.toJson(cr); } + } else { + if (request.getPublicKey() != null) { + if (!request.verifySignature()) { + request.setPublicKey(null); + request.setRequester(null); + } + } } client.times++; // 将合约状态改为“Executing”