mirror of
https://gitee.com/BDWare/agent-backend
synced 2025-01-09 17:34:13 +00:00
feat: update SelfAdaptiveShardingExecutor
update SelfAdaptiveShardingExecutor to add height to the blocks; update cmstop.sh to not print error message when process doesn't exits
This commit is contained in:
parent
802713a001
commit
b975a0227a
@ -2,7 +2,7 @@
|
||||
|
||||
if [ -a "./PID" ]; 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
|
||||
kill -9 $(cat PID)
|
||||
echo "shutdown old contract manager"
|
||||
|
@ -588,7 +588,7 @@ public class MasterClientRecoverMechAction {
|
||||
try {
|
||||
FileReader fr = new FileReader(file);
|
||||
BufferedReader br = new BufferedReader(fr);
|
||||
String line = "";
|
||||
String line;
|
||||
String[] arrs = null;
|
||||
while ((line = br.readLine()) != null) {
|
||||
content[count++] = line;
|
||||
|
@ -79,9 +79,9 @@ public class ContractRepoConfigurer implements DoipServiceInfoConfigurer {
|
||||
doipServiceConfig = localConfig;
|
||||
//异步注册
|
||||
ContractManager.threadPool.execute(() -> {
|
||||
GlobalIrpClient.useInternalIrpClient(GlobalCertifications.localKeypair
|
||||
, GlobalConfigurations.User_Handle
|
||||
, GlobalConfigurations.LHS_Address);
|
||||
GlobalIrpClient.useInternalIrpClient(GlobalCertifications.localKeypair,
|
||||
GlobalConfigurations.User_Handle,
|
||||
GlobalConfigurations.LHS_Address);
|
||||
if (doipServiceInfo.id.equals("")) {
|
||||
try {
|
||||
doipServiceInfo.id = GlobalIrpClient.getGlobalClient().register(doipServiceInfo.toServiceHandleRecord());
|
||||
|
@ -187,7 +187,7 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
|
||||
block.requests.length,
|
||||
block.hash));
|
||||
// TODO create check point
|
||||
this.b = new Block(block.hash);
|
||||
this.b = new Block(block.hash, this.b.height + 1);
|
||||
executedBlocks.add(block.hash);
|
||||
}
|
||||
|
||||
@ -228,6 +228,7 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
|
||||
static class Block extends SM2Verifiable {
|
||||
String prevHash = "0";
|
||||
String hash;
|
||||
int height;
|
||||
String checkPoint;
|
||||
String body;
|
||||
String nodePubKey;
|
||||
@ -235,10 +236,12 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
|
||||
long timestamp;
|
||||
|
||||
public Block() {
|
||||
this.height = 0;
|
||||
}
|
||||
|
||||
public Block(String prev) {
|
||||
public Block(String prev, int height) {
|
||||
this.prevHash = prev;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public void fillBlock(ContractRequest[] requests) {
|
||||
@ -255,6 +258,7 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
|
||||
|
||||
private String computeHash() {
|
||||
return HashUtil.sha3(
|
||||
String.valueOf(this.height),
|
||||
this.prevHash,
|
||||
this.checkPoint,
|
||||
this.body);
|
||||
|
Loading…
Reference in New Issue
Block a user