update nexa 收益计算器问题

This commit is contained in:
yyb
2025-06-17 11:28:22 +08:00
parent 4fad507896
commit 315079e5d1
7 changed files with 56 additions and 14 deletions

View File

@@ -434,7 +434,7 @@ public class PoolServiceImpl implements PoolService {
}
else {
BlockInfo info = redisService.getCacheObject(pool.getCoin() + "_block");
System.out.println("yyb-redis key"+ pool.getCoin() + "_block" +"查询结果"+ info);
if(StringUtils.isNull(info)){
if(!"enx".equals(pool.getCoin()) && !"alph".equals(pool.getCoin())){
//

View File

@@ -84,7 +84,6 @@ public class NodeTask {
@Scheduled(cron = "0 0/1 * * * ?")
public void NEXABlockInfoToRedis(){
BlockInfo blockInfo = NodeRpc.getBlock("nexa");
int count = 0;
while (StringUtils.isNull(blockInfo)){
if(count >= 3){

View File

@@ -239,7 +239,9 @@ public class NodeRpc{
}
String[] params = {nowHeight,"2"};
Object[] statsParams = {Convert.toLong(nowHeight)};
String result = getResult(coin, "getmininginfo", params);
String result2 = getResultTest(coin, "getblockstats", statsParams);
BlockInfo blockInfo = new BlockInfo();
if(StringUtils.isBlank(result)){
@@ -253,11 +255,16 @@ public class NodeRpc{
}
JSONObject jsonObject = JSON.parseObject(result);
JSONObject statsJs = JSON.parseObject(result2);
long height = jsonObject.getLongValue("blocks");
blockInfo.setHeight(height);
BigDecimal difficulty = jsonObject.getBigDecimal("difficulty");
BigDecimal subsidy = statsJs.getBigDecimal("subsidy");
if(StringUtils.isNull(subsidy)) {
System.out.println("subsidy获取结果为空");
return blockInfo;
}
if(StringUtils.isNotNull(difficulty)){
blockInfo.setDifficulty(difficulty.setScale(2,BigDecimal.ROUND_HALF_UP));
//NodeConstant constant = (NodeConstant) EnumUtils.get(NodeConstant.class, coin);
@@ -294,7 +301,7 @@ public class NodeRpc{
// }
//});
blockInfo.setReward(BigDecimal.valueOf(reward[0]));
blockInfo.setReward(subsidy);
blockInfo.setFees(BigDecimal.valueOf(fees[0]));
blockInfo.setProfit(blockInfo.getReward().subtract(blockInfo.getFees()));
System.out.println("blockInfo信息rpc"+blockInfo);