Merge remote-tracking branch 'origin/master'

This commit is contained in:
CaiHQ 2021-12-07 21:09:20 +08:00
commit 5ffc5fb813
4 changed files with 11 additions and 7 deletions

View File

@ -2,7 +2,7 @@
if [ -a "./PID" ]; then if [ -a "./PID" ]; then
if [ -d '/proc' ]; then if [ -d '/proc' ]; then
ls /proc/$(cat PID)/cmdline ls /proc/$(cat PID)/cmdline 1>/dev/null 2>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
kill -9 $(cat PID) kill -9 $(cat PID)
echo "shutdown old contract manager" echo "shutdown old contract manager"

View File

@ -588,7 +588,7 @@ public class MasterClientRecoverMechAction {
try { try {
FileReader fr = new FileReader(file); FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr); BufferedReader br = new BufferedReader(fr);
String line = ""; String line;
String[] arrs = null; String[] arrs = null;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
content[count++] = line; content[count++] = line;

View File

@ -79,9 +79,9 @@ public class ContractRepoConfigurer implements DoipServiceInfoConfigurer {
doipServiceConfig = localConfig; doipServiceConfig = localConfig;
//异步注册 //异步注册
ContractManager.threadPool.execute(() -> { ContractManager.threadPool.execute(() -> {
GlobalIrpClient.useInternalIrpClient(GlobalCertifications.localKeypair GlobalIrpClient.useInternalIrpClient(GlobalCertifications.localKeypair,
, GlobalConfigurations.User_Handle GlobalConfigurations.User_Handle,
, GlobalConfigurations.LHS_Address); GlobalConfigurations.LHS_Address);
if (doipServiceInfo.id.equals("")) { if (doipServiceInfo.id.equals("")) {
try { try {
doipServiceInfo.id = GlobalIrpClient.getGlobalClient().register(doipServiceInfo.toServiceHandleRecord()); doipServiceInfo.id = GlobalIrpClient.getGlobalClient().register(doipServiceInfo.toServiceHandleRecord());

View File

@ -187,7 +187,7 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
block.requests.length, block.requests.length,
block.hash)); block.hash));
// TODO create check point // TODO create check point
this.b = new Block(block.hash); this.b = new Block(block.hash, this.b.height + 1);
executedBlocks.add(block.hash); executedBlocks.add(block.hash);
} }
@ -228,6 +228,7 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
static class Block extends SM2Verifiable { static class Block extends SM2Verifiable {
String prevHash = "0"; String prevHash = "0";
String hash; String hash;
int height;
String checkPoint; String checkPoint;
String body; String body;
String nodePubKey; String nodePubKey;
@ -235,10 +236,12 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
long timestamp; long timestamp;
public Block() { public Block() {
this.height = 0;
} }
public Block(String prev) { public Block(String prev, int height) {
this.prevHash = prev; this.prevHash = prev;
this.height = height;
} }
public void fillBlock(ContractRequest[] requests) { public void fillBlock(ContractRequest[] requests) {
@ -255,6 +258,7 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
private String computeHash() { private String computeHash() {
return HashUtil.sha3( return HashUtil.sha3(
String.valueOf(this.height),
this.prevHash, this.prevHash,
this.checkPoint, this.checkPoint,
this.body); this.body);