mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
mempool_tx structure was made lighter
This commit is contained in:
parent
46c8d5ec1a
commit
13a9060b8b
3 changed files with 36 additions and 37 deletions
|
@ -23,13 +23,6 @@ MempoolStatus::set_blockchain_variables(MicroCore *_mcore,
|
|||
void
|
||||
MempoolStatus::start_mempool_status_thread()
|
||||
{
|
||||
// initialize network info as not current.
|
||||
// so we know that what ever values are returned, they
|
||||
// dont come from the deamon now.
|
||||
network_info local_copy = current_network_info;
|
||||
local_copy.current = false;
|
||||
local_copy.info_timestamp = 0;
|
||||
current_network_info = local_copy;
|
||||
|
||||
if (mempool_refresh_time < 1)
|
||||
{
|
||||
|
@ -162,7 +155,7 @@ MempoolStatus::read_mempool()
|
|||
|
||||
mempool_size_kB += _tx_info.blob_size;
|
||||
|
||||
local_copy_of_mempool_txs.push_back(mempool_tx {tx_hash_reconstructed, _tx_info, tx});
|
||||
local_copy_of_mempool_txs.push_back(mempool_tx {tx_hash_reconstructed, tx});
|
||||
|
||||
mempool_tx& last_tx = local_copy_of_mempool_txs.back();
|
||||
|
||||
|
@ -176,6 +169,8 @@ MempoolStatus::read_mempool()
|
|||
const array<uint64_t, 4>& sum_data = summary_of_in_out_rct(
|
||||
tx, output_pub_keys, input_key_imgs);
|
||||
|
||||
last_tx.receive_time = _tx_info.receive_time;
|
||||
|
||||
last_tx.sum_outputs = sum_data[0];
|
||||
last_tx.sum_inputs = sum_data[1];
|
||||
last_tx.no_outputs = output_pub_keys.size();
|
||||
|
@ -252,12 +247,14 @@ MempoolStatus::read_network_info()
|
|||
local_copy.incoming_connections_count = rpc_network_info.incoming_connections_count;
|
||||
local_copy.white_peerlist_size = rpc_network_info.white_peerlist_size;
|
||||
local_copy.testnet = rpc_network_info.testnet;
|
||||
epee::string_tools::hex_to_pod(rpc_network_info.top_block_hash, local_copy.top_block_hash);
|
||||
local_copy.cumulative_difficulty = rpc_network_info.cumulative_difficulty;
|
||||
local_copy.block_size_limit = rpc_network_info.block_size_limit;
|
||||
local_copy.start_time = rpc_network_info.start_time;
|
||||
|
||||
epee::string_tools::hex_to_pod(rpc_network_info.top_block_hash, local_copy.top_block_hash);
|
||||
local_copy.fee_per_kb = fee_estimated;
|
||||
local_copy.info_timestamp = static_cast<uint64_t>(std::time(nullptr));
|
||||
|
||||
local_copy.current = true;
|
||||
|
||||
current_network_info = local_copy;
|
||||
|
|
|
@ -25,9 +25,9 @@ struct MempoolStatus
|
|||
struct mempool_tx
|
||||
{
|
||||
crypto::hash tx_hash;
|
||||
tx_info info;
|
||||
transaction tx;
|
||||
|
||||
uint64_t receive_time {0};
|
||||
uint64_t sum_inputs {0};
|
||||
uint64_t sum_outputs {0};
|
||||
uint64_t no_inputs {0};
|
||||
|
@ -48,26 +48,28 @@ struct MempoolStatus
|
|||
// the current info timesout.
|
||||
struct network_info
|
||||
{
|
||||
uint64_t height;
|
||||
bool testnet;
|
||||
bool current;
|
||||
uint64_t height {0};
|
||||
uint64_t target_height {0};
|
||||
uint64_t difficulty {0};
|
||||
uint64_t target {0};
|
||||
uint64_t tx_count {0};
|
||||
uint64_t tx_pool_size {0};
|
||||
uint64_t alt_blocks_count {0};
|
||||
uint64_t outgoing_connections_count {0};
|
||||
uint64_t incoming_connections_count {0};
|
||||
uint64_t white_peerlist_size {0};
|
||||
uint64_t grey_peerlist_size {0};
|
||||
bool testnet {false};
|
||||
crypto::hash top_block_hash;
|
||||
uint64_t target_height;
|
||||
uint64_t difficulty;
|
||||
uint64_t target;
|
||||
uint64_t tx_count;
|
||||
uint64_t tx_pool_size;
|
||||
uint64_t alt_blocks_count;
|
||||
uint64_t outgoing_connections_count;
|
||||
uint64_t incoming_connections_count;
|
||||
uint64_t white_peerlist_size;
|
||||
uint64_t grey_peerlist_size;
|
||||
uint64_t cumulative_difficulty;
|
||||
uint64_t block_size_limit;
|
||||
uint64_t start_time;
|
||||
uint64_t hash_rate;
|
||||
uint64_t fee_per_kb;
|
||||
uint64_t info_timestamp;
|
||||
uint64_t cumulative_difficulty {0};
|
||||
uint64_t block_size_limit {0};
|
||||
uint64_t start_time {0};
|
||||
|
||||
uint64_t hash_rate {0};
|
||||
uint64_t fee_per_kb {0};
|
||||
uint64_t info_timestamp {0};
|
||||
|
||||
bool current {false};
|
||||
};
|
||||
|
||||
static boost::thread m_thread;
|
||||
|
|
16
src/page.h
16
src/page.h
|
@ -858,7 +858,7 @@ namespace xmreg
|
|||
// calculate difference between tx in mempool and server timestamps
|
||||
array<size_t, 5> delta_time = timestamp_difference(
|
||||
local_copy_server_timestamp,
|
||||
mempool_tx.info.receive_time);
|
||||
mempool_tx.receive_time);
|
||||
|
||||
// use only hours, so if we have days, add
|
||||
// it to hours
|
||||
|
@ -881,10 +881,10 @@ namespace xmreg
|
|||
|
||||
// set output page template map
|
||||
txs.push_back(mstch::map {
|
||||
{"timestamp_no" , mempool_tx.info.receive_time},
|
||||
{"timestamp_no" , mempool_tx.receive_time},
|
||||
{"timestamp" , mempool_tx.timestamp_str},
|
||||
{"age" , age_str},
|
||||
{"hash" , mempool_tx.info.id_hash},
|
||||
{"hash" , pod_to_hex(mempool_tx.tx_hash)},
|
||||
{"fee" , mempool_tx.fee_str},
|
||||
{"xmr_inputs" , mempool_tx.xmr_inputs_str},
|
||||
{"xmr_outputs" , mempool_tx.xmr_outputs_str},
|
||||
|
@ -1165,7 +1165,7 @@ namespace xmreg
|
|||
// so use its recive_time as timestamp to show
|
||||
|
||||
uint64_t tx_recieve_timestamp
|
||||
= found_txs.at(0).info.receive_time;
|
||||
= found_txs.at(0).receive_time;
|
||||
|
||||
blk_timestamp = xmreg::timestamp_to_str_gm(tx_recieve_timestamp);
|
||||
|
||||
|
@ -1486,7 +1486,7 @@ namespace xmreg
|
|||
// so use its recive_time as timestamp to show
|
||||
|
||||
uint64_t tx_recieve_timestamp
|
||||
= found_txs.at(0).info.receive_time;
|
||||
= found_txs.at(0).receive_time;
|
||||
|
||||
blk_timestamp = xmreg::timestamp_to_str_gm(tx_recieve_timestamp);
|
||||
|
||||
|
@ -3585,7 +3585,7 @@ namespace xmreg
|
|||
|
||||
// tx in mempool have no blk_timestamp
|
||||
// but can use their recive time
|
||||
blk_timestamp = found_txs.at(0).info.receive_time;
|
||||
blk_timestamp = found_txs.at(0).receive_time;
|
||||
|
||||
}
|
||||
|
||||
|
@ -4320,7 +4320,7 @@ namespace xmreg
|
|||
json j_tx = get_tx_json(mempool_tx->tx, txd);
|
||||
|
||||
// we add some extra data, for mempool txs, such as recieve timestamp
|
||||
j_tx["timestamp"] = mempool_tx->info.receive_time;
|
||||
j_tx["timestamp"] = mempool_tx->receive_time;
|
||||
j_tx["timestamp_utc"] = mempool_tx->timestamp_str;
|
||||
|
||||
j_txs.push_back(j_tx);
|
||||
|
@ -4745,7 +4745,7 @@ namespace xmreg
|
|||
// there should be only one tx found
|
||||
tx = found_txs.at(0).tx;
|
||||
found_in_mempool = true;
|
||||
tx_timestamp = found_txs.at(0).info.receive_time;
|
||||
tx_timestamp = found_txs.at(0).receive_time;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue