|
|
|
@ -126,75 +126,64 @@ MempoolStatus::read_mempool()
|
|
|
|
|
// get transaction info of the tx in the mempool
|
|
|
|
|
const tx_info& _tx_info = mempool_tx_info.at(i);
|
|
|
|
|
|
|
|
|
|
crypto::hash mem_tx_hash = null_hash;
|
|
|
|
|
transaction tx;
|
|
|
|
|
crypto::hash tx_hash;
|
|
|
|
|
crypto::hash tx_prefix_hash;
|
|
|
|
|
|
|
|
|
|
if (epee::string_tools::hex_to_pod(_tx_info.id_hash, mem_tx_hash))
|
|
|
|
|
if (!parse_and_validate_tx_from_blob(
|
|
|
|
|
_tx_info.tx_blob, tx, tx_hash, tx_prefix_hash))
|
|
|
|
|
{
|
|
|
|
|
transaction tx;
|
|
|
|
|
cerr << "Cant make tx from _tx_info.tx_blob" << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!xmreg::make_tx_from_json(_tx_info.tx_json, tx))
|
|
|
|
|
{
|
|
|
|
|
cerr << "Cant make tx from _tx_info.tx_json" << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
crypto::hash tx_hash_reconstructed = get_transaction_hash(tx);
|
|
|
|
|
mempool_size_kB += _tx_info.blob_size;
|
|
|
|
|
|
|
|
|
|
if (mem_tx_hash != tx_hash_reconstructed)
|
|
|
|
|
{
|
|
|
|
|
cerr << "Hash of reconstructed tx from json does not match "
|
|
|
|
|
"what we should get!"
|
|
|
|
|
<< endl;
|
|
|
|
|
local_copy_of_mempool_txs.push_back(mempool_tx {tx_hash, tx});
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
mempool_tx& last_tx = local_copy_of_mempool_txs.back();
|
|
|
|
|
|
|
|
|
|
mempool_size_kB += _tx_info.blob_size;
|
|
|
|
|
// key images of inputs
|
|
|
|
|
vector<txin_to_key> input_key_imgs;
|
|
|
|
|
|
|
|
|
|
local_copy_of_mempool_txs.push_back(mempool_tx {tx_hash_reconstructed, tx});
|
|
|
|
|
// public keys and xmr amount of outputs
|
|
|
|
|
vector<pair<txout_to_key, uint64_t>> output_pub_keys;
|
|
|
|
|
|
|
|
|
|
mempool_tx& last_tx = local_copy_of_mempool_txs.back();
|
|
|
|
|
// sum xmr in inputs and ouputs in the given tx
|
|
|
|
|
const array<uint64_t, 4>& sum_data = summary_of_in_out_rct(
|
|
|
|
|
tx, output_pub_keys, input_key_imgs);
|
|
|
|
|
|
|
|
|
|
// key images of inputs
|
|
|
|
|
vector<txin_to_key> input_key_imgs;
|
|
|
|
|
last_tx.receive_time = _tx_info.receive_time;
|
|
|
|
|
|
|
|
|
|
// public keys and xmr amount of outputs
|
|
|
|
|
vector<pair<txout_to_key, uint64_t>> output_pub_keys;
|
|
|
|
|
last_tx.sum_outputs = sum_data[0];
|
|
|
|
|
last_tx.sum_inputs = sum_data[1];
|
|
|
|
|
last_tx.no_outputs = output_pub_keys.size();
|
|
|
|
|
last_tx.no_inputs = input_key_imgs.size();
|
|
|
|
|
last_tx.mixin_no = sum_data[2];
|
|
|
|
|
last_tx.num_nonrct_inputs = sum_data[3];
|
|
|
|
|
|
|
|
|
|
// sum xmr in inputs and ouputs in the given tx
|
|
|
|
|
const array<uint64_t, 4>& sum_data = summary_of_in_out_rct(
|
|
|
|
|
tx, output_pub_keys, input_key_imgs);
|
|
|
|
|
last_tx.fee_str = xmreg::xmr_amount_to_str(_tx_info.fee, "{:0.3f}", false);
|
|
|
|
|
last_tx.xmr_inputs_str = xmreg::xmr_amount_to_str(last_tx.sum_inputs , "{:0.3f}");
|
|
|
|
|
last_tx.xmr_outputs_str = xmreg::xmr_amount_to_str(last_tx.sum_outputs, "{:0.3f}");
|
|
|
|
|
last_tx.timestamp_str = xmreg::timestamp_to_str_gm(_tx_info.receive_time);
|
|
|
|
|
|
|
|
|
|
last_tx.receive_time = _tx_info.receive_time;
|
|
|
|
|
last_tx.txsize = fmt::format("{:0.2f}",
|
|
|
|
|
static_cast<double>(_tx_info.blob_size)/1024.0);
|
|
|
|
|
|
|
|
|
|
last_tx.sum_outputs = sum_data[0];
|
|
|
|
|
last_tx.sum_inputs = sum_data[1];
|
|
|
|
|
last_tx.no_outputs = output_pub_keys.size();
|
|
|
|
|
last_tx.no_inputs = input_key_imgs.size();
|
|
|
|
|
last_tx.mixin_no = sum_data[2];
|
|
|
|
|
last_tx.num_nonrct_inputs = sum_data[3];
|
|
|
|
|
last_tx.pID = '-';
|
|
|
|
|
|
|
|
|
|
last_tx.fee_str = xmreg::xmr_amount_to_str(_tx_info.fee, "{:0.3f}", false);
|
|
|
|
|
last_tx.xmr_inputs_str = xmreg::xmr_amount_to_str(last_tx.sum_inputs , "{:0.3f}");
|
|
|
|
|
last_tx.xmr_outputs_str = xmreg::xmr_amount_to_str(last_tx.sum_outputs, "{:0.3f}");
|
|
|
|
|
last_tx.timestamp_str = xmreg::timestamp_to_str_gm(_tx_info.receive_time);
|
|
|
|
|
crypto::hash payment_id;
|
|
|
|
|
crypto::hash8 payment_id8;
|
|
|
|
|
|
|
|
|
|
last_tx.txsize = fmt::format("{:0.2f}",
|
|
|
|
|
static_cast<double>(_tx_info.blob_size)/1024.0);
|
|
|
|
|
get_payment_id(tx, payment_id, payment_id8);
|
|
|
|
|
|
|
|
|
|
last_tx.pID = '-';
|
|
|
|
|
if (payment_id != null_hash)
|
|
|
|
|
last_tx.pID = 'l'; // legacy payment id
|
|
|
|
|
else if (payment_id8 != null_hash8)
|
|
|
|
|
last_tx.pID = 'e'; // encrypted payment id
|
|
|
|
|
|
|
|
|
|
crypto::hash payment_id;
|
|
|
|
|
crypto::hash8 payment_id8;
|
|
|
|
|
|
|
|
|
|
get_payment_id(tx, payment_id, payment_id8);
|
|
|
|
|
|
|
|
|
|
if (payment_id != null_hash)
|
|
|
|
|
last_tx.pID = 'l'; // legacy payment id
|
|
|
|
|
else if (payment_id8 != null_hash8)
|
|
|
|
|
last_tx.pID = 'e'; // encrypted payment id
|
|
|
|
|
|
|
|
|
|
} // if (hex_to_pod(_tx_info.id_hash, mem_tx_hash))
|
|
|
|
|
// } // if (hex_to_pod(_tx_info.id_hash, mem_tx_hash))
|
|
|
|
|
|
|
|
|
|
} // for (size_t i = 0; i < mempool_tx_info.size(); ++i)
|
|
|
|
|
|
|
|
|
|