fixed sorting of yield_info output in CLI
This commit is contained in:
@@ -124,7 +124,7 @@ bool isFat32(const wchar_t* root_path)
|
||||
|
||||
// Helper function to generate genesis transaction
|
||||
void print_genesis_tx_hex(const cryptonote::network_type nettype) {
|
||||
/*
|
||||
|
||||
using namespace cryptonote;
|
||||
|
||||
account_base miner_acc1;
|
||||
@@ -141,9 +141,9 @@ void print_genesis_tx_hex(const cryptonote::network_type nettype) {
|
||||
miner_key_file << "Miner account address:" << std::endl;
|
||||
miner_key_file << cryptonote::get_account_address_as_str((network_type)nettype, false, miner_acc1.get_keys().m_account_address);
|
||||
miner_key_file << std::endl<< "Miner spend secret key:" << std::endl;
|
||||
epee::to_hex::formatted(miner_key_file, epee::as_byte_span(miner_acc1.get_keys().m_spend_secret_key));
|
||||
epee::to_hex::formatted(miner_key_file, epee::as_byte_span(unwrap(unwrap(miner_acc1.get_keys().m_spend_secret_key))));
|
||||
miner_key_file << std::endl << "Miner view secret key:" << std::endl;
|
||||
epee::to_hex::formatted(miner_key_file, epee::as_byte_span(miner_acc1.get_keys().m_view_secret_key));
|
||||
epee::to_hex::formatted(miner_key_file, epee::as_byte_span(unwrap(unwrap(miner_acc1.get_keys().m_view_secret_key))));
|
||||
miner_key_file << std::endl << std::endl;
|
||||
miner_key_file.close();
|
||||
|
||||
@@ -153,13 +153,13 @@ void print_genesis_tx_hex(const cryptonote::network_type nettype) {
|
||||
std::cout << "Object:" << std::endl;
|
||||
std::cout << obj_to_json_str(tx_genesis) << std::endl << std::endl;
|
||||
|
||||
std::cout << "Gennerating miner wallet..." << std::endl;
|
||||
std::cout << "Generating miner wallet..." << std::endl;
|
||||
std::cout << "Miner account address:" << std::endl;
|
||||
std::cout << cryptonote::get_account_address_as_str((network_type)nettype, false, miner_acc1.get_keys().m_account_address);
|
||||
std::cout << std::endl << "Miner spend secret key:" << std::endl;
|
||||
epee::to_hex::formatted(std::cout, epee::as_byte_span(miner_acc1.get_keys().m_spend_secret_key));
|
||||
epee::to_hex::formatted(std::cout, epee::as_byte_span(unwrap(unwrap(miner_acc1.get_keys().m_spend_secret_key))));
|
||||
std::cout << std::endl << "Miner view secret key:" << std::endl;
|
||||
epee::to_hex::formatted(std::cout, epee::as_byte_span(miner_acc1.get_keys().m_view_secret_key));
|
||||
epee::to_hex::formatted(std::cout, epee::as_byte_span(unwrap(unwrap(miner_acc1.get_keys().m_view_secret_key))));
|
||||
std::cout << std::endl << std::endl;
|
||||
|
||||
std::stringstream ss;
|
||||
@@ -168,7 +168,6 @@ void print_genesis_tx_hex(const cryptonote::network_type nettype) {
|
||||
std::string tx_hex = ss.str();
|
||||
std::cout << "Insert this line into your coin configuration file: " << std::endl;
|
||||
std::cout << "std::string const GENESIS_TX = \"" << epee::string_tools::buff_to_hex_nodelimer(tx_hex) << "\";" << std::endl;
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8549,12 +8549,18 @@ bool simple_wallet::yield_info(const std::vector<std::string> &args) {
|
||||
|
||||
// EXPERIMENTAL - change to get_yield_summary_info() method
|
||||
uint64_t t_burnt, t_supply, t_locked, t_yield, yps, ybi_size;
|
||||
std::vector<std::tuple<size_t, std::string, std::string, uint64_t, uint64_t>> yield_payouts;
|
||||
std::vector<tools::wallet2::yield_payout_t> yield_payouts;
|
||||
if (!m_wallet->get_yield_summary_info(t_burnt, t_supply, t_locked, t_yield, yps, ybi_size, yield_payouts)) {
|
||||
fail_msg_writer() << "failed to get yield info. Make sure you are connected to a daemon.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resort the payouts so they're in height order
|
||||
std::sort( yield_payouts.begin( ), yield_payouts.end( ), [ ]( const tools::wallet2::yield_payout_t& lhs, const tools::wallet2::yield_payout_t& rhs )
|
||||
{
|
||||
return std::get<0>(lhs) < std::get<0>(rhs);
|
||||
});
|
||||
|
||||
// Get the chain height
|
||||
const uint64_t blockchain_height = m_wallet->get_blockchain_current_height();
|
||||
uint64_t stake_lock_period = get_config(m_wallet->nettype()).STAKE_LOCK_PERIOD;
|
||||
|
||||
@@ -2412,7 +2412,7 @@ bool wallet2::get_yield_summary_info(uint64_t &total_burnt,
|
||||
uint64_t &total_yield,
|
||||
uint64_t &yield_per_stake,
|
||||
uint64_t &ybi_data_size,
|
||||
std::vector<std::tuple<size_t, std::string, std::string, uint64_t, uint64_t>> &payouts
|
||||
std::vector<yield_payout_t> &payouts
|
||||
)
|
||||
{
|
||||
// Get the total circulating supply of SALs
|
||||
|
||||
@@ -1760,13 +1760,16 @@ private:
|
||||
bool get_pricing_record(oracle::pricing_record& pr, const uint64_t height);
|
||||
bool get_circulating_supply(std::vector<std::pair<std::string, std::string>> &amounts);
|
||||
bool get_yield_info(std::vector<cryptonote::yield_block_info>& ybi_data);
|
||||
|
||||
typedef std::tuple<size_t, std::string, std::string, uint64_t, uint64_t> yield_payout_t;
|
||||
|
||||
bool get_yield_summary_info(uint64_t &total_burnt,
|
||||
uint64_t &total_supply,
|
||||
uint64_t &total_locked,
|
||||
uint64_t &total_yield,
|
||||
uint64_t &yield_per_stake,
|
||||
uint64_t &ybi_data_size,
|
||||
std::vector<std::tuple<size_t, std::string, std::string, uint64_t, uint64_t>> &payouts
|
||||
std::vector<yield_payout_t> &payouts
|
||||
);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user