socket fixed
This commit is contained in:
parent
c82de3cae2
commit
118f8dd5c6
@ -182,13 +182,14 @@ console.log(__dirname);
|
|||||||
BlockchainOutput],
|
BlockchainOutput],
|
||||||
}]).then(async () => {
|
}]).then(async () => {
|
||||||
|
|
||||||
|
var connection_test = await getConnection("Testnet");
|
||||||
const server = app.listen(PORT, () => {
|
const server = app.listen(PORT, () => {
|
||||||
console.log(`Node Express server listening on http://localhost:${PORT}`);
|
console.log(`Node Express server listening on http://localhost:${PORT}`);
|
||||||
});
|
});
|
||||||
const io = require("socket.io").listen(server);
|
const io = require("socket.io").listen(server);
|
||||||
io.sockets.on("connection", socket => {
|
io.sockets.on("connection", socket => {
|
||||||
//setTimeout(function() {
|
//setTimeout(function() {
|
||||||
universalGetLatestBlockDetails(socket);
|
universalGetLatestBlockDetails(socket, connection_test);
|
||||||
//},1000);
|
//},1000);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -70,7 +70,7 @@ function convertMinsToHrmin(millseconds, insec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function universalGetLatestBlockDetails(socket) {
|
export async function universalGetLatestBlockDetails(socket, connection_test) {
|
||||||
|
|
||||||
|
|
||||||
let block_height = "",
|
let block_height = "",
|
||||||
@ -78,9 +78,9 @@ export async function universalGetLatestBlockDetails(socket) {
|
|||||||
letest_block_num = "",
|
letest_block_num = "",
|
||||||
letest_block_duration = "";
|
letest_block_duration = "";
|
||||||
|
|
||||||
const BlockchainLatestBlockQuery = await getConnection("Testnet").query(
|
const BlockchainLatestBlockQuery = await connection_test.query(
|
||||||
"SELECT bb.timestamp,bb.proof,bb.height,bb.edge_bits,bb.hash,bb.secondary_scaling, bb.previous_id, bb.total_difficulty_cuckaroo, bb.total_difficulty_cuckatoo, bb.total_difficulty_progpow, bb.total_difficulty_randomx, COUNT(DISTINCT(bi.block_id)) AS input_count, COUNT(DISTINCT(bk.block_id)) AS kernel_count, COUNT(DISTINCT(bo.block_id)) AS output_count FROM blockchain_block bb LEFT JOIN blockchain_input bi ON bi.block_id = bb.hash LEFT JOIN blockchain_kernel bk ON bk.block_id = bb.hash LEFT JOIN blockchain_output bo ON bo.block_id = bb.hash group by bb.hash, bb.timestamp ORDER BY bb.timestamp DESC LIMIT 1");
|
"SELECT bb.timestamp,bb.proof,bb.height,bb.edge_bits,bb.hash,bb.secondary_scaling, bb.previous_id, bb.total_difficulty_cuckaroo, bb.total_difficulty_cuckatoo, bb.total_difficulty_progpow, bb.total_difficulty_randomx, COUNT(DISTINCT(bi.block_id)) AS input_count, COUNT(DISTINCT(bk.block_id)) AS kernel_count, COUNT(DISTINCT(bo.block_id)) AS output_count FROM blockchain_block bb LEFT JOIN blockchain_input bi ON bi.block_id = bb.hash LEFT JOIN blockchain_kernel bk ON bk.block_id = bb.hash LEFT JOIN blockchain_output bo ON bo.block_id = bb.hash group by bb.hash, bb.timestamp ORDER BY bb.timestamp DESC LIMIT 1");
|
||||||
const BlockchainPreviousBlockQuery = await getConnection("Testnet").query(
|
const BlockchainPreviousBlockQuery = await connection_test.query(
|
||||||
"SELECT total_difficulty_cuckaroo, total_difficulty_cuckatoo, total_difficulty_progpow, total_difficulty_randomx FROM blockchain_block WHERE hash=" +
|
"SELECT total_difficulty_cuckaroo, total_difficulty_cuckatoo, total_difficulty_progpow, total_difficulty_randomx FROM blockchain_block WHERE hash=" +
|
||||||
"'" +
|
"'" +
|
||||||
BlockchainLatestBlockQuery[0].previous_id +
|
BlockchainLatestBlockQuery[0].previous_id +
|
||||||
@ -296,6 +296,6 @@ export async function universalGetLatestBlockDetails(socket) {
|
|||||||
BlockchainLatestBlockQuery[0].total_difficulty_randomx
|
BlockchainLatestBlockQuery[0].total_difficulty_randomx
|
||||||
});
|
});
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
universalGetLatestBlockDetails(socket);
|
universalGetLatestBlockDetails(socket, connection_test);
|
||||||
},1000);
|
},1000);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user