Skip to content

Commit 0f65763

Browse files
authored
Merge pull request #4547 from halibobo1205/fix/lite_tool_merge
fix(lite):fix merge function.
2 parents f63edf3 + 7886456 commit 0f65763

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

framework/src/main/java/org/tron/core/db/Manager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,8 @@ public void init() {
489489

490490
long headNum = chainBaseManager.getDynamicPropertiesStore().getLatestBlockHeaderNumber();
491491
logger.info("current headNum is: {}", headNum);
492+
int nodeType = chainBaseManager.getCommonStore().getNodeType();
493+
logger.info("node type is: {}", Constant.NODE_TYPE_LIGHT_NODE == nodeType ? "lite" : "full");
492494
revokingStore.enable();
493495
validateSignService = Executors
494496
.newFixedThreadPool(Args.getInstance().getValidateSignThreadNum());

framework/src/main/java/org/tron/tool/litefullnode/LiteFullNodeTool.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private void split(String sourceDir, String destDir, List<String> dbs) throws IO
209209
if (new File(destDir).exists()) {
210210
throw new RuntimeException("destDir is already exist, please remove it first");
211211
}
212-
if (!destPath.mkdir()) {
212+
if (!destPath.mkdirs()) {
213213
throw new RuntimeException("destDir create failed, please check");
214214
}
215215
Util.copyDatabases(Paths.get(sourceDir), Paths.get(destDir), dbs);
@@ -486,9 +486,15 @@ private static boolean isEmptyBytes(byte[] b) {
486486
return true;
487487
}
488488

489-
private void deleteSnapshotFlag(String databaseDir) throws IOException {
489+
private void deleteSnapshotFlag(String databaseDir) throws IOException, RocksDBException {
490490
logger.info("-- delete the info file to identify this node is a real fullnode.");
491491
Files.delete(Paths.get(databaseDir, INFO_FILE_NAME));
492+
493+
DBInterface destCommonDb = DbTool.getDB(databaseDir, COMMON_DB_NAME);
494+
destCommonDb.delete(DB_KEY_NODE_TYPE);
495+
destCommonDb.delete(DB_KEY_LOWEST_BLOCK_NUM);
496+
logger.info("-- deleted node_type and lowest_block_num from "
497+
+ "common to identify this node is a real fullnode.");
492498
}
493499

494500
private void run(Args argv) {

0 commit comments

Comments
 (0)