update 全网报块定时任务修复

This commit is contained in:
yyb
2025-08-13 13:36:41 +08:00
parent 94899a4baa
commit 7258909381
4 changed files with 27 additions and 4 deletions

View File

@@ -591,7 +591,7 @@ public class NodeTask {
} catch (Exception e) {
retryCount++;
if (retryCount >= maxRetries) {
log.error("插入区块 alph 数据失败,重试 {} 次后仍失败", maxRetries, e);
log.error("插入区块 alph 数据失败,重试 {} 次后仍失败,失败原因{}", maxRetries, e.getMessage());
break;
}
try {
@@ -641,13 +641,15 @@ public class NodeTask {
*/
private void insertBlockWithDgbSeries(int maxRetries) {
int retryCount = 0;
System.out.println("dgb 总高度执行");
while (retryCount < maxRetries) {
try {
//这里随便填一个dgb 的算法类型, dgb 共用一个高度
String height = NodeRpc.getHeight("dgbq");
System.out.println("dgb 总高度:"+height);
//需要记录每次的dgb 总的高度,方便下次循环遍历
Integer lastHeight = poolMapper.getDgbTotalHeight();
System.out.println("dgb 总高度lastHeight:"+lastHeight);
if (lastHeight != null){
// 从数据库获取dgb系列的币种的最新高度(因为这是新接口是从0开始计算的高度)
@@ -661,8 +663,9 @@ public class NodeTask {
//总高度 - 上次的总高度 然后循环遍历这些块高度,来判断该块的算法类型,
for (int i = Integer.parseInt(height) ; i > lastHeight ; i--){
String hashBlock = NodeRpc.getBlockHash("dgbq", i);
System.out.println("dgb 总高度hashBlock:"+hashBlock);
String dgbType = NodeRpc.getBlockInfoByHash("dgbq", hashBlock);
System.out.println("dgb 总高度dgbType:"+dgbType);
if("qubit".equals(dgbType)){
dgbqIncrement++;
}else if ("odo".equals(dgbType)){
@@ -713,5 +716,6 @@ public class NodeTask {
}
}
}
}
}

View File

@@ -257,7 +257,7 @@ public class NodeRpc{
*/
public static String getBlockInfoByHash(String coin,String hash){
String[] params = {hash};
String result = getResult(coin, "getblock",params);
String result = getResultTest(coin, "getblock",params);
if(StringUtils.isBlank(result)){
System.out.println("查询哈希块详细信息结果为空"+result);
return result;