From 3ffeeb96ff255ebbf078aa23c6c882a6e4650598 Mon Sep 17 00:00:00 2001 From: June <2571240520@qq.com> Date: Fri, 21 Jun 2024 15:03:43 +0800 Subject: [PATCH] fixed node create TX block diff is 1. --- src/main/java/io/xdag/core/BlockchainImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/io/xdag/core/BlockchainImpl.java b/src/main/java/io/xdag/core/BlockchainImpl.java index 4e300dcf..0a3808b6 100644 --- a/src/main/java/io/xdag/core/BlockchainImpl.java +++ b/src/main/java/io/xdag/core/BlockchainImpl.java @@ -1105,6 +1105,11 @@ public BigInteger calculateCurrentBlockDiff(Block block) { if (block.getInfo().getDifficulty() != null) { return block.getInfo().getDifficulty(); } + //TX block would not set diff, fix a diff = 1; + if (!block.getInputs().isEmpty()) { + return BigInteger.ONE; + } + BigInteger blockDiff; // 初始区块自身难度设置 if (randomx != null && randomx.isRandomxFork(XdagTime.getEpoch(block.getTimestamp()))