Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #15 from jagerman/loki6-compilation
Browse files Browse the repository at this point in the history
Loki6 compilation
  • Loading branch information
Doy-lee committed Jan 9, 2020
2 parents f6bbc7e + 373820b commit b59953c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 33 deletions.
6 changes: 3 additions & 3 deletions main.cpp
Expand Up @@ -56,6 +56,7 @@ main(int ac, const char* av[])
auto mainnet_url = opts.get_option<string>("mainnet-url");
auto mempool_info_timeout_opt = opts.get_option<string>("mempool-info-timeout");
auto mempool_refresh_time_opt = opts.get_option<string>("mempool-refresh-time");
auto log_level = opts.get_option<string>("log-level");
auto testnet_opt = opts.get_option<bool>("testnet");
auto stagenet_opt = opts.get_option<bool>("stagenet");
auto enable_key_image_checker_opt = opts.get_option<bool>("enable-key-image-checker");
Expand Down Expand Up @@ -101,10 +102,9 @@ main(int ac, const char* av[])


// set loki log output level
uint32_t log_level = 0;
mlog_configure("", true);

(void) log_level;
if (log_level)
mlog_set_log(log_level->c_str());

//cast port number in string to uint
uint16_t app_port = boost::lexical_cast<uint16_t>(*port_opt);
Expand Down
4 changes: 3 additions & 1 deletion src/CmdLineOptions.cpp
Expand Up @@ -74,7 +74,9 @@ namespace lokeg
("ssl-key-file", value<string>(),
"path to key file for ssl (https) functionality")
("daemon-url,d", value<string>()->default_value("http:://127.0.0.1:22023"),
"Loki daemon url");
"Loki daemon url")
("log-level", value<string>(),
"set log level");


store(command_line_parser(acc, avv)
Expand Down
8 changes: 6 additions & 2 deletions src/CurrentBlockchainStatus.cpp
Expand Up @@ -91,7 +91,9 @@ static void update_circulating_supply()
{
if (tx.vin.at(0).type() != typeid(txin_gen))
{
fees += get_tx_fee(tx);
fees += get_tx_miner_fee(tx, false /*don't subtract burned amount*/);

// FIXME: calculate, store, and show burned amounts
}
}
}
Expand Down Expand Up @@ -293,7 +295,9 @@ CurrentBlockchainStatus::calculate_emission_in_blocks(

for(const auto& tx: txs)
{
tx_fee_amount += get_tx_fee(tx);
tx_fee_amount += get_tx_miner_fee(tx, false /*don't subtract burned amount*/);

// FIXME: calculate, store, and show burned amounts
}

(void) missed_txs;
Expand Down
23 changes: 11 additions & 12 deletions src/page.h
Expand Up @@ -824,10 +824,11 @@ mstch::array gather_sn_data(const std::vector<std::string> &nodes, const sn_entr
return data;
}

mstch::map get_quorum_state_context(uint64_t start_height, uint64_t end_height, size_t num_quorums, size_t sn_display_limit = 20, service_nodes::quorum_type type = service_nodes::quorum_type::rpc_request_all_quorums_sentinel_value) {
mstch::map get_quorum_state_context(uint64_t start_height, uint64_t end_height, size_t num_quorums, size_t sn_display_limit = 20, const service_nodes::quorum_type *type = nullptr) {

uint8_t q_type = type ? static_cast<uint8_t>(*type) : COMMAND_RPC_GET_QUORUM_STATE::ALL_QUORUMS_SENTINEL_VALUE;
COMMAND_RPC_GET_QUORUM_STATE::response response = {};
rpc.get_quorum_state(response, start_height, end_height, static_cast<uint8_t>(type));
rpc.get_quorum_state(response, start_height, end_height, q_type);

sn_entry_map pk2sninfo;
{
Expand All @@ -839,10 +840,12 @@ mstch::map get_quorum_state_context(uint64_t start_height, uint64_t end_height,
}

std::vector<std::pair<service_nodes::quorum_type, std::string>> quorum_types;
if (type == service_nodes::quorum_type::rpc_request_all_quorums_sentinel_value || type == service_nodes::quorum_type::obligations)
if (!type || *type == service_nodes::quorum_type::obligations)
quorum_types.emplace_back(service_nodes::quorum_type::obligations, "obligations");
if (type == service_nodes::quorum_type::rpc_request_all_quorums_sentinel_value || type == service_nodes::quorum_type::checkpointing)
if (!type || *type == service_nodes::quorum_type::checkpointing)
quorum_types.emplace_back(service_nodes::quorum_type::checkpointing, "checkpointing");
if (!type || *type == service_nodes::quorum_type::blink)
quorum_types.emplace_back(service_nodes::quorum_type::blink, "blink");

mstch::map page_context {};

Expand Down Expand Up @@ -891,10 +894,7 @@ mstch::map get_quorum_state_context(uint64_t start_height, uint64_t end_height,
}

std::string render_single_quorum_html(service_nodes::quorum_type qtype, uint64_t height) {
auto page_context = get_quorum_state_context(height, height, 1, std::numeric_limits<size_t>::max(), qtype);

if (qtype == service_nodes::quorum_type::checkpointing)

auto page_context = get_quorum_state_context(height, height, 1, std::numeric_limits<size_t>::max(), &qtype);
add_css_style(page_context);
return mstch::render(template_file["quorum_states_full"], page_context);
}
Expand Down Expand Up @@ -3651,7 +3651,6 @@ show_checkrawtx(string raw_tx_data, string action)

mstch::map tx_cd_data {
{"no_of_sources" , static_cast<uint64_t>(no_of_sources)},
{"use_rct" , tx_cd.v2_use_rct},
{"change_amount" , lokeg::lok_amount_to_str(tx_change.amount)},
{"has_payment_id" , (payment_id != null_hash)},
{"has_payment_id8" , (payment_id8 != null_hash8)},
Expand Down Expand Up @@ -6235,7 +6234,7 @@ json_outputs(string tx_hash_str,
// check if submited data in the request
// matches to what was used to produce response.
j_data["tx_hash"] = pod_to_hex(txd.hash);
j_data["address"] = pod_to_hex(address_info.address);
j_data["address"] = REMOVE_HASH_BRAKETS(lokeg::print_address(address_info, nettype));
j_data["viewkey"] = pod_to_hex(prv_view_key);
j_data["tx_prove"] = tx_prove;

Expand Down Expand Up @@ -6417,7 +6416,7 @@ json_outputsblocks(string _limit,
// return parsed values. can be use to double
// check if submited data in the request
// matches to what was used to produce response.
j_data["address"] = pod_to_hex(address_info.address);
j_data["address"] = REMOVE_HASH_BRAKETS(lokeg::print_address(address_info, nettype));
j_data["viewkey"] = pod_to_hex(prv_view_key);
j_data["limit"] = _limit;
j_data["height"] = height;
Expand Down Expand Up @@ -7395,7 +7394,7 @@ get_tx_details(const transaction& tx,
if (tx.vin.at(0).type() != typeid(txin_gen))
{
// get tx fee
txd.fee = get_tx_fee(tx);
txd.fee = get_tx_miner_fee(tx, false /*don't subtract burned amounts*/);
}
}

Expand Down
22 changes: 8 additions & 14 deletions src/rpccalls.cpp
Expand Up @@ -150,10 +150,8 @@ bool
rpccalls::get_network_info(COMMAND_RPC_GET_INFO::response& response)
{

epee::json_rpc::request<cryptonote::COMMAND_RPC_GET_INFO::request>
req_t = AUTO_VAL_INIT(req_t);
epee::json_rpc::response<cryptonote::COMMAND_RPC_GET_INFO::response, std::string>
resp_t = AUTO_VAL_INIT(resp_t);
epee::json_rpc::request<cryptonote::COMMAND_RPC_GET_INFO::request> req_t{};
epee::json_rpc::response<cryptonote::COMMAND_RPC_GET_INFO::response, std::string> resp_t{};

bool r {false};

Expand Down Expand Up @@ -211,8 +209,8 @@ bool
rpccalls::get_staking_requirement(uint64_t height, COMMAND_RPC_GET_STAKING_REQUIREMENT::response& response)
{

epee::json_rpc::request<cryptonote::COMMAND_RPC_GET_STAKING_REQUIREMENT::request> req_t = AUTO_VAL_INIT(req_t);
epee::json_rpc::response<cryptonote::COMMAND_RPC_GET_STAKING_REQUIREMENT::response, std::string> resp_t = AUTO_VAL_INIT(resp_t);
epee::json_rpc::request<cryptonote::COMMAND_RPC_GET_STAKING_REQUIREMENT::request> req_t{};
epee::json_rpc::response<cryptonote::COMMAND_RPC_GET_STAKING_REQUIREMENT::response, std::string> resp_t{};

bool r {false};

Expand Down Expand Up @@ -270,8 +268,8 @@ rpccalls::get_staking_requirement(uint64_t height, COMMAND_RPC_GET_STAKING_REQUI
bool
rpccalls::get_hardfork_info(COMMAND_RPC_HARD_FORK_INFO::response& response)
{
epee::json_rpc::request<cryptonote::COMMAND_RPC_HARD_FORK_INFO::request> req_t = AUTO_VAL_INIT(req_t);
epee::json_rpc::response<cryptonote::COMMAND_RPC_HARD_FORK_INFO::response, std::string> resp_t = AUTO_VAL_INIT(resp_t);
epee::json_rpc::request<cryptonote::COMMAND_RPC_HARD_FORK_INFO::request> req_t{};
epee::json_rpc::response<cryptonote::COMMAND_RPC_HARD_FORK_INFO::response, std::string> resp_t{};


bool r {false};
Expand Down Expand Up @@ -336,10 +334,8 @@ rpccalls::get_fee_estimate(
uint64_t& fee_per_out,
string& error_msg)
{
epee::json_rpc::request<COMMAND_RPC_GET_BASE_FEE_ESTIMATE::request>
req_t = AUTO_VAL_INIT(req_t);
epee::json_rpc::response<COMMAND_RPC_GET_BASE_FEE_ESTIMATE::response, std::string>
resp_t = AUTO_VAL_INIT(resp_t);
epee::json_rpc::request<COMMAND_RPC_GET_BASE_FEE_ESTIMATE::request> req_t{};
epee::json_rpc::response<COMMAND_RPC_GET_BASE_FEE_ESTIMATE::response, std::string> resp_t{};


req_t.jsonrpc = "2.0";
Expand Down Expand Up @@ -541,8 +537,6 @@ bool rpccalls::get_checkpoints(COMMAND_RPC_GET_CHECKPOINTS::response &res, uint3
if (!result)
cerr << "Error connecting to Loki daemon at " << daemon_url << endl;

std::cerr << "wtf; result has " << res.checkpoints.size() << " checkpoints\n";

res = std::move(response.result);
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools.cpp
Expand Up @@ -611,7 +611,7 @@ sum_fees_in_txs(const vector<transaction>& txs)

for (const transaction& tx: txs)
{
fees_sum += get_tx_fee(tx);
fees_sum += get_tx_miner_fee(tx, false /*don't subtract burned amounts*/);
}

return fees_sum;
Expand Down

0 comments on commit b59953c

Please sign in to comment.