support alph

This commit is contained in:
lzx
2025-04-15 11:15:38 +08:00
parent 9fe4d9145a
commit 90ae1d1852
7 changed files with 157 additions and 70 deletions

View File

@@ -31,7 +31,7 @@ class Balance extends Init {
async query_now_height(last_height){
try{
const [chain_height, [db_height]] = await Promise.all([this.node.getblockcount(), this.query_min_height()])
return chain_height > db_height.min_height + this.MAX_MATURE && chain_height > last_height + 2// 在成熟高度基础上再+2高度防止pool_account转账未更新
return chain_height > db_height.min_height + this.MAX_MATURE && chain_height > last_height + 5// 在成熟高度基础上再+2高度防止pool_account转账未更新
} catch(err){
throw err
}
@@ -152,7 +152,7 @@ class DGBBlance extends Init {
try{
const sql = `SELECT MAX(max_height) AS max_height FROM wallet_in WHERE coin Like "dgb%" AND state = ?;`
const [chain_height, [db_height]] = await Promise.all([this.node.getblockcount(), this.distribution.exec(sql, [0])])
return chain_height > db_height.max_height + this.MAX_MATURE && chain_height > last_height + 2
return chain_height > db_height.max_height + this.MAX_MATURE && chain_height > last_height + 5
} catch(err){
throw err
}

View File

@@ -41,9 +41,12 @@ class Confirm extends Init {
} else {
const now = Date.now().valueOf()
const max_mature_time = now - this.MAX_MATURE * 60 * 1000
console.log("MAX_MATURE:", this.MAX_MATURE);
console.log("max_mature_time: ", max_mature_time);
const ymd = Times.utcTime(max_mature_time)
const sql = `SELECT MAX(height) AS max_height FROM alph_blkreportprofitv2 WHERE date <= ? AND state = ?;`
const data = await this.distribution.exec(sql, [ymd, 0])
console.log("data: ", data);
if(!data[0]){
console.log(`alph当前时间没有需要更新的成熟区块`);
return false

View File

@@ -321,6 +321,10 @@ class Distribution extends Init {
accuracy = 100;
should_out_date = end_time;
count = 2
} else if(this.coin === "alph"){
accuracy = 0
should_out_date = end_time;
count = 0
} else {
should_out_date = end_time;
accuracy = 100000000;

View File

@@ -50,7 +50,7 @@ class Report extends Init {
const values = [];
for (let item of data) {
const { date, height, hash, reward, fees } = item;
values.push(date, height, hash, reward, fees, 0);
values.push(date, height, hash, reward.toString(), fees, 0);
sql += `(?,?,?,?,?,?), `;
}
sql = sql.slice(0, -2);
@@ -78,7 +78,7 @@ class Report extends Init {
if (check_result) {
const block = this.node.block(check_result);
const { height, hash, time, block_reward, block_fees } = block;
suc_data.push({ date: Times.utcTime(time * 1000), height, hash, reward: block_reward, fees: block_fees });
suc_data.push({ date: Times.utcTime(time * 1000), height, hash, reward: block_reward.toString(), fees: block_fees });
}
}
if (suc_data.length === 0) {