Compare commits

...

9 Commits

Author SHA1 Message Date
Some Random Crypto Guy 77683cafa1 Merge branch 'develop' 2024-08-29 12:44:29 +01:00
Some Random Crypto Guy e193d141bf new translations; tweaked API to allow GUI to obtain staking TX data; bumped version 2024-08-29 12:28:20 +01:00
Some Random Crypto Guy c248b78831 switched simple_wallet over to new routines for yield calculations; updated yield_info display to include yield earned on active STAKE TXs 2024-08-19 13:28:30 +01:00
Some Random Crypto Guy 6b75cb1fb5 fixed erroneous display of staked coins in all wallet balances 2024-08-19 11:07:45 +01:00
Some Random Crypto Guy a926092d9a Merge branch 'main' into develop 2024-08-19 11:06:52 +01:00
Some Random Crypto Guy 6d8e925fdb disabled Trezor until protobuf fixes are available; disabled moneropulse issues; bumped version number 2024-08-16 20:47:03 +01:00
Some Random Crypto Guy 0ee3c669d6 disabled staking from secondary accounts; basic search+replace for Monero in translations 2024-08-16 15:05:26 +01:00
Some Random Crypto Guy addd26cd47 Fixes include:
- setting DEFAULT_STACK_TRACE=OFF for all release builds (prevents boost weak_ptr crash on some Linux systems)
- setting RPC-SSL to disabled by default (fixes "no connection to daemon" error)
- updated BlockchainLMDB::get_circulating_supply() to report staked coins as something other than BURNT
- bumped to v0.4.5
2024-08-16 14:01:11 +01:00
Some Random Crypto Guy 9e96fcfe3a Merge branch 'main' into develop 2024-08-12 11:34:08 +01:00
72 changed files with 67553 additions and 277636 deletions
+2 -2
View File
@@ -538,7 +538,7 @@ elseif (DEPENDS AND NOT LINUX)
set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "")
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
set(DEFAULT_STACK_TRACE ON)
set(DEFAULT_STACK_TRACE OFF)
set(STACK_TRACE_LIB "easylogging++") # for diag output only
set(LIBUNWIND_LIBRARIES "")
elseif (ARM)
@@ -547,7 +547,7 @@ elseif (ARM)
else()
find_package(Libunwind)
if(LIBUNWIND_FOUND)
set(DEFAULT_STACK_TRACE ON)
set(DEFAULT_STACK_TRACE OFF)
set(STACK_TRACE_LIB "libunwind") # for diag output only
else()
set(DEFAULT_STACK_TRACE OFF)
+3 -3
View File
@@ -6,10 +6,10 @@ function(_trezor_default_val val_name val_default)
endfunction()
# Define default options via env vars
_trezor_default_val(USE_DEVICE_TREZOR ON)
_trezor_default_val(USE_DEVICE_TREZOR OFF)
_trezor_default_val(USE_DEVICE_TREZOR_MANDATORY OFF)
_trezor_default_val(USE_DEVICE_TREZOR_PROTOBUF_TEST ON)
_trezor_default_val(USE_DEVICE_TREZOR_LIBUSB ON)
_trezor_default_val(USE_DEVICE_TREZOR_PROTOBUF_TEST OFF)
_trezor_default_val(USE_DEVICE_TREZOR_LIBUSB OFF)
_trezor_default_val(USE_DEVICE_TREZOR_UDP_RELEASE OFF)
_trezor_default_val(USE_DEVICE_TREZOR_DEBUG OFF)
_trezor_default_val(TREZOR_DEBUG OFF)
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
# Get the git information
TAG=`git tag -l --points-at HEAD`
COMMIT=`git rev-parse --short=9 HEAD`
# Build the 64-bit Apple Silicon release
USE_DEVICE_TREZOR=OFF make depends target=aarch64-apple-darwin -j12
pushd ./build/aarch64-apple-darwin/release/bin > /dev/null
zip -ur ~/releases/salvium-${TAG}-macos-arm64.zip salviumd salvium-wallet-cli salvium-wallet-rpc
popd > /dev/null
# Build the 64-bit MacOS Intel Silicon release
USE_DEVICE_TREZOR=OFF make depends target=x86_64-apple-darwin -j12
pushd ./build/x86_64-apple-darwin/release/bin > /dev/null
zip -ur ~/releases/salvium-${TAG}-macos-x86_64.zip salviumd salvium-wallet-cli salvium-wallet-rpc
popd > /dev/null
# Build the 64-bit Linux release
USE_DEVICE_TREZOR=OFF make depends target=x86_64-linux-gnu -j12
pushd ./build/x86_64-linux-gnu/release/bin > /dev/null
zip -ur ~/releases/salvium-${TAG}-linux-x86_64.zip salviumd salvium-wallet-cli salvium-wallet-rpc
popd > /dev/null
# Build the 64-bit Windows release
USE_DEVICE_TREZOR=OFF make depends target=x86_64-w64-mingw32 -j12
pushd ./build/x86_64-w64-mingw32/release/bin > /dev/null
zip -ur ~/releases/salvium-${TAG}-win64.zip salviumd.exe salvium-wallet-cli.exe salvium-wallet-rpc.exe
popd > /dev/null
# Finish
+2 -2
View File
@@ -1915,8 +1915,8 @@ public:
*/
virtual uint64_t get_database_size() const = 0;
virtual int get_yield_block_info(const uint64_t height, yield_block_info& ybi) = 0;
virtual int get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container) = 0;
virtual int get_yield_block_info(const uint64_t height, yield_block_info& ybi) const = 0;
virtual int get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container) const = 0;
/**
+17 -8
View File
@@ -800,7 +800,7 @@ estim:
return threshold_size;
}
int BlockchainLMDB::get_yield_block_info(const uint64_t height, yield_block_info& ybi)
int BlockchainLMDB::get_yield_block_info(const uint64_t height, yield_block_info& ybi) const
{
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
check_open();
@@ -825,11 +825,13 @@ int BlockchainLMDB::get_yield_block_info(const uint64_t height, yield_block_info
yield_block_info *p = (yield_block_info*)v.mv_data;
ybi = *p;
TXN_POSTFIX_RDONLY();
// Return success to caller
return ret;
}
int BlockchainLMDB::get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container)
int BlockchainLMDB::get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container) const
{
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
check_open();
@@ -858,6 +860,8 @@ int BlockchainLMDB::get_yield_tx_info(const uint64_t height, std::vector<yield_t
yti_container.emplace_back(*p);
}
TXN_POSTFIX_RDONLY();
// Return success to caller
return 0;
}
@@ -3469,9 +3473,12 @@ std::map<std::string,uint64_t> BlockchainLMDB::get_circulating_supply() const
uint64_t m_coinbase = get_block_already_generated_coins(m_height-1);
LOG_PRINT_L3("BlockchainLMDB::" << __func__ << " - mined supply for SAL = " << m_coinbase);
// SRCG: For V1, we can simply return this number, because there is no other source of coins
//circulating_supply["SAL"] = m_coinbase;
//return circulating_supply;
uint64_t staked_coins = 0;
yield_block_info ybi;
int result = get_yield_block_info(m_height-1, ybi);
if (result)
throw0(DB_ERROR(lmdb_error("Failed to get YBI when querying supply: ", result).c_str()));
staked_coins = ybi.locked_coins_tally;
check_open();
@@ -3480,8 +3487,6 @@ std::map<std::string,uint64_t> BlockchainLMDB::get_circulating_supply() const
MDB_val k;
MDB_val v;
int result = 0;
MDB_cursor_op op = MDB_FIRST;
while (1)
{
@@ -3513,7 +3518,11 @@ std::map<std::string,uint64_t> BlockchainLMDB::get_circulating_supply() const
if (circulating_supply.empty()) {
circulating_supply["SAL"] = m_coinbase;
}
circulating_supply["BURN"] = m_coinbase - circulating_supply["SAL"];
// Adjust the supply to account for the staked coins
circulating_supply["STAKE"] = staked_coins;
circulating_supply["BURN"] = m_coinbase - circulating_supply["SAL"] - circulating_supply["STAKE"];
return circulating_supply;
}
+2 -2
View File
@@ -459,8 +459,8 @@ private:
//void migrate_0_1();
void cleanup_batch();
virtual int get_yield_block_info(const uint64_t height, yield_block_info& ybi);
virtual int get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container);
virtual int get_yield_block_info(const uint64_t height, yield_block_info& ybi) const;
virtual int get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container) const;
private:
MDB_env* m_env;
+6 -6
View File
@@ -249,22 +249,22 @@ namespace cryptonote
std::vector<std::string> records;
// All four MoneroPulse domains have DNSSEC on and valid
static const std::vector<std::string> dns_urls = { "checkpoints.moneropulse.se"
static const std::vector<std::string> dns_urls = { /*"checkpoints.moneropulse.se"
, "checkpoints.moneropulse.org"
, "checkpoints.moneropulse.net"
, "checkpoints.moneropulse.co"
, "checkpoints.moneropulse.co"*/
};
static const std::vector<std::string> testnet_dns_urls = { "testpoints.moneropulse.se"
static const std::vector<std::string> testnet_dns_urls = { /*"testpoints.moneropulse.se"
, "testpoints.moneropulse.org"
, "testpoints.moneropulse.net"
, "testpoints.moneropulse.co"
, "testpoints.moneropulse.co"*/
};
static const std::vector<std::string> stagenet_dns_urls = { "stagenetpoints.moneropulse.se"
static const std::vector<std::string> stagenet_dns_urls = { /*"stagenetpoints.moneropulse.se"
, "stagenetpoints.moneropulse.org"
, "stagenetpoints.moneropulse.net"
, "stagenetpoints.moneropulse.co"
, "stagenetpoints.moneropulse.co"*/
};
if (!tools::dns_utils::load_txt_records_from_dns(records, nettype == TESTNET ? testnet_dns_urls : nettype == STAGENET ? stagenet_dns_urls : dns_urls))
+13 -6
View File
@@ -1478,7 +1478,7 @@ bool Blockchain::validate_miner_transaction(const block& b, size_t cumulative_bl
}
//------------------------------------------------------------------
// SRCG
bool Blockchain::validate_protocol_transaction(const block& b, uint64_t height, std::vector<std::pair<transaction, blobdata>>& txs, const std::map<std::string, uint64_t>& circ_supply, uint8_t hf_version)
bool Blockchain::validate_protocol_transaction(const block& b, uint64_t height, std::vector<std::pair<transaction, blobdata>>& txs, uint8_t hf_version)
{
LOG_PRINT_L3("Blockchain::" << __func__);
CHECK_AND_ASSERT_MES(b.tx_hashes.size() == txs.size(), false, "Invalid number of TXs / hashes supplied");
@@ -1488,6 +1488,17 @@ bool Blockchain::validate_protocol_transaction(const block& b, uint64_t height,
CHECK_AND_ASSERT_MES(b.protocol_tx.vout.size() == 0, false, "void protocol transaction in the block has outputs");
return true;
}
if (!b.protocol_tx.vout.size()) {
// No money is minted, nothing to verify - bail out
return true;
}
// Get the circulating supply so we can verify
std::map<std::string, uint64_t> circ_supply;
if (hf_version >= HF_VERSION_ENABLE_CONVERT) {
circ_supply = get_db().get_circulating_supply();
}
// Build a map of outputs from the protocol_tx
std::map<crypto::public_key, std::tuple<std::string, uint64_t, uint64_t>> outputs;
@@ -4900,12 +4911,8 @@ leave:
}
TIME_MEASURE_FINISH(vmt);
TIME_MEASURE_START(gcs);
std::map<std::string, uint64_t> circ_supply = get_db().get_circulating_supply();
TIME_MEASURE_FINISH(gcs);
TIME_MEASURE_START(vpt);
if(!validate_protocol_transaction(bl, blockchain_height, txs, circ_supply, m_hardfork->get_current_version()))
if(!validate_protocol_transaction(bl, blockchain_height, txs, m_hardfork->get_current_version()))
{
MERROR_VER("Block with id: " << id << " has incorrect protocol transaction");
bvc.m_verifivation_failed = true;
+1 -1
View File
@@ -1521,7 +1521,7 @@ namespace cryptonote
*
* @return false if anything is found wrong with the protocol transaction, otherwise true
*/
bool validate_protocol_transaction(const block& b, uint64_t height, std::vector<std::pair<transaction, blobdata>>& txs, const std::map<std::string, uint64_t>& circ_supply, uint8_t hf_version);
bool validate_protocol_transaction(const block& b, uint64_t height, std::vector<std::pair<transaction, blobdata>>& txs, uint8_t hf_version);
/**
* @brief reverts the blockchain to its previous state following a failed switch
+1 -1
View File
@@ -1898,7 +1898,7 @@ namespace cryptonote
if (!tools::check_updates(software, buildtag, version, hash))
return false;
if (tools::vercmp(version.c_str(), MONERO_VERSION) <= 0)
if (tools::vercmp(version.c_str(), SALVIUM_VERSION) <= 0)
{
m_update_available = false;
return true;
+2 -2
View File
@@ -3183,7 +3183,7 @@ namespace cryptonote
return true;
}
static const char software[] = "monero";
static const char software[] = "salvium";
#ifdef BUILD_TAG
static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG);
static const char subdir[] = "cli";
@@ -3204,7 +3204,7 @@ namespace cryptonote
res.status = "Error checking for updates";
return true;
}
if (tools::vercmp(version.c_str(), MONERO_VERSION) <= 0)
if (tools::vercmp(version.c_str(), SALVIUM_VERSION) <= 0)
{
res.update = false;
res.status = CORE_RPC_STATUS_OK;
+1 -1
View File
@@ -98,7 +98,7 @@ namespace cryptonote
, rpc_login({"rpc-login", rpc_args::tr("Specify username[:password] required for RPC server"), "", true})
, confirm_external_bind({"confirm-external-bind", rpc_args::tr("Confirm rpc-bind-ip value is NOT a loopback (local) IP")})
, rpc_access_control_origins({"rpc-access-control-origins", rpc_args::tr("Specify a comma separated list of origins to allow cross origin resource sharing"), ""})
, rpc_ssl({"rpc-ssl", rpc_args::tr("Enable SSL on RPC connections: enabled|disabled|autodetect"), "autodetect"})
, rpc_ssl({"rpc-ssl", rpc_args::tr("Enable SSL on RPC connections: enabled|disabled|autodetect"), "disabled"})
, rpc_ssl_private_key({"rpc-ssl-private-key", rpc_args::tr("Path to a PEM format private key"), ""})
, rpc_ssl_certificate({"rpc-ssl-certificate", rpc_args::tr("Path to a PEM format certificate"), ""})
, rpc_ssl_ca_certificates({"rpc-ssl-ca-certificates", rpc_args::tr("Path to file containing concatenated PEM format certificate(s) to replace system CA(s)."), ""})
+33 -77
View File
@@ -8394,86 +8394,42 @@ bool simple_wallet::supply_info(const std::vector<std::string> &args) {
//----------------------------------------------------------------------------------------------------
bool simple_wallet::yield_info(const std::vector<std::string> &args) {
// Get the total circulating supply of SALs
std::vector<std::pair<std::string, std::string>> supply_amounts;
if(!m_wallet->get_circulating_supply(supply_amounts)) {
fail_msg_writer() << "failed to get circulating supply. Make sure you are connected to a daemon.";
return false;
}
boost::multiprecision::uint128_t total_supply_128 = 0;
for (auto supply_asset: supply_amounts) {
if (supply_asset.first == "SAL") {
boost::multiprecision::uint128_t supply_128(supply_asset.second);
total_supply_128 = supply_128;
break;
}
}
// 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, uint64_t, uint64_t>> yield_payouts;
bool ok = m_wallet->get_yield_summary_info(t_burnt, t_supply, t_locked, t_yield, yps, ybi_size, yield_payouts);
// Get the yield data from the blockchain
std::vector<cryptonote::yield_block_info> ybi_data;
bool r = m_wallet->get_yield_info(ybi_data);
if (!r)
return false;
// Scan the entries we have received to gather the state (total yield over period captured)
uint64_t total_burnt = 0;
uint64_t total_yield = 0;
uint64_t yield_per_stake = 0;
for (size_t idx=1; idx<ybi_data.size(); ++idx) {
if (ybi_data[idx].locked_coins_tally == 0) {
total_burnt += ybi_data[idx].slippage_total_this_block;
} else {
total_yield += ybi_data[idx].slippage_total_this_block;
}
}
// Calculate the yield_per_staked_SAL value
if (ybi_data.back().locked_coins_tally > 0) {
boost::multiprecision::uint128_t yield_per_stake_128 = ybi_data.back().slippage_total_this_block;
yield_per_stake_128 *= COIN;
yield_per_stake_128 /= ybi_data.back().locked_coins_tally;
yield_per_stake = yield_per_stake_128.convert_to<uint64_t>();
}
// Get the chain height
const uint64_t blockchain_height = m_wallet->get_blockchain_current_height();
// Output the necessary information about yield stats
message_writer(console_color_default, false) << boost::format(tr("YIELD INFO:\n\tSupply coins burnt over last %s: %d\n\tTotal coins locked: %d\n\tYield accrued over last %s: %d\n\tYield per SAL staked: %d"))
% get_human_readable_timespan((ybi_data.size()-1) * DIFFICULTY_TARGET_V2)
% print_money(total_burnt)
% print_money(ybi_data.back().locked_coins_tally)
% get_human_readable_timespan((ybi_data.size()-1) * DIFFICULTY_TARGET_V2)
% print_money(total_yield)
% print_money(yield_per_stake);
// Now summarise our own YIELD TXs that are yet to mature
tools::wallet2::transfer_container transfers;
m_wallet->get_transfers(transfers);
if (transfers.empty())
return true;
std::map<size_t, size_t> payouts;
message_writer(console_color_default, false) << boost::format(tr("\nSTAKED FUNDS:"));
for (size_t idx = transfers.size()-1; idx>0; --idx) {
const tools::wallet2::transfer_details& td = transfers[idx];
//if (td.m_block_height < ybi_data[0].block_height) break;
if (td.m_tx.type == cryptonote::transaction_type::STAKE) {
if (payouts.count(idx)) {
message_writer(console_color_green, true) << boost::format(tr("Height %d, txid %s, staked %s SAL, earned %s SAL"))
% td.m_block_height
% td.m_txid
% print_money(td.m_tx.amount_burnt)
% print_money(transfers[payouts[idx]].m_amount - td.m_tx.amount_burnt);
} else {
message_writer(console_color_green, false) << boost::format(tr("Height %d, txid %s, staked %s SAL"))
% td.m_block_height
% td.m_txid
% print_money(td.m_tx.amount_burnt);
}
} else if (td.m_tx.type == cryptonote::transaction_type::PROTOCOL) {
// Store list of reverse-lookup indices to tell YIELD TXs how much they earned
if (transfers[td.m_td_origin_idx].m_tx.type == cryptonote::transaction_type::STAKE)
payouts[td.m_td_origin_idx] = idx;
}
}
for (auto &p: yield_payouts) {
uint64_t height, burnt, yield;
std::string txid;
std::tie(height, txid, burnt, yield) = p;
if (blockchain_height > ybi_size + height)
message_writer(console_color_green, true) << boost::format(tr("Height %d, txid %s, staked %s SAL, earned %s SAL"))
% height
% txid
% print_money(burnt)
% print_money(yield);
else
message_writer(console_color_green, false) << boost::format(tr("Height %d, txid %s, staked %s SAL, %s SAL accrued so far"))
% height
% txid
% print_money(burnt)
% print_money(yield);
}
// Output the necessary information about yield stats
message_writer(console_color_default, false) << boost::format(tr("\nYIELD INFO:\n\tSupply coins burnt over last %s: %d\n\tTotal coins locked: %d\n\tYield accrued over last %s: %d\n\tYield per SAL staked: %d"))
% get_human_readable_timespan((ybi_size-1) * DIFFICULTY_TARGET_V2)
% print_money(t_burnt)
% print_money(t_locked)
% get_human_readable_timespan((ybi_size-1) * DIFFICULTY_TARGET_V2)
% print_money(t_yield)
% print_money(yps);
return true;
}
//----------------------------------------------------------------------------------------------------
+1 -1
View File
@@ -1,5 +1,5 @@
#define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@"
#define DEF_SALVIUM_VERSION "0.4.4-beta2"
#define DEF_SALVIUM_VERSION "0.5.1"
#define DEF_MONERO_VERSION_TAG "release"
#define DEF_MONERO_VERSION "0.18.3.3"
#define DEF_MONERO_RELEASE_NAME "Zero"
+1 -1
View File
@@ -370,7 +370,7 @@ std::tuple<bool, std::string, std::string, std::string, std::string> WalletManag
if (!tools::check_updates(software, buildtag, version, hash))
return std::make_tuple(false, "", "", "", "");
if (tools::vercmp(version.c_str(), current_version != nullptr ? current_version : MONERO_VERSION) > 0)
if (tools::vercmp(version.c_str(), current_version != nullptr ? current_version : SALVIUM_VERSION) > 0)
{
std::string user_url = tools::get_update_url(software, subdir, buildtag, version, true);
std::string auto_url = tools::get_update_url(software, subdir, buildtag, version, false);
+39 -3
View File
@@ -2411,6 +2411,27 @@ bool wallet2::get_yield_summary_info(uint64_t &total_burnt,
return false;
ybi_data_size = ybi_data.size();
// Iterate over the transfers in our wallet
std::map<size_t, size_t> map_payouts;
std::map<std::string, std::pair<size_t, std::pair<uint64_t, uint64_t>>> payouts_active;
for (size_t idx = m_transfers.size()-1; idx>0; --idx) {
const tools::wallet2::transfer_details& td = m_transfers[idx];
//if (td.m_block_height < ybi_data[0].block_height) break;
if (td.m_tx.type == cryptonote::transaction_type::STAKE) {
if (map_payouts.count(idx)) {
payouts.push_back(std::make_tuple(td.m_block_height, epee::string_tools::pod_to_hex(td.m_txid), td.m_tx.amount_burnt, m_transfers[map_payouts[idx]].m_amount - td.m_tx.amount_burnt));
} else {
//payouts.push_back(std::make_tuple(td.m_block_height, epee::string_tools::pod_to_hex(td.m_txid), td.m_tx.amount_burnt, 0));
payouts_active[epee::string_tools::pod_to_hex(td.m_txid)] = std::make_pair(td.m_block_height, std::make_pair(td.m_tx.amount_burnt, 0));
}
} else if (td.m_tx.type == cryptonote::transaction_type::PROTOCOL) {
// Store list of reverse-lookup indices to tell YIELD TXs how much they earned
if (m_transfers[td.m_td_origin_idx].m_tx.type == cryptonote::transaction_type::STAKE)
map_payouts[td.m_td_origin_idx] = idx;
}
}
// Scan the entries we have received to gather the state (total yield over period captured)
total_burnt = 0;
@@ -2421,9 +2442,23 @@ bool wallet2::get_yield_summary_info(uint64_t &total_burnt,
total_burnt += ybi_data[idx].slippage_total_this_block;
} else {
total_yield += ybi_data[idx].slippage_total_this_block;
// EXPERIMENTAL - add up yield earned for active STAKE TXs
for (auto &payout: payouts_active) {
if (ybi_data[idx].block_height < payout.second.first) continue;
boost::multiprecision::uint128_t amount_128 = ybi_data[idx].slippage_total_this_block;
amount_128 *= payout.second.second.first;
amount_128 /= ybi_data[idx].locked_coins_tally;
payout.second.second.second += amount_128.convert_to<uint64_t>();
}
}
}
for (auto &payout: payouts_active) {
// Copy to the list of payouts proper
payouts.push_back(std::make_tuple(payout.second.first, payout.first, payout.second.second.first, payout.second.second.second));
}
// Get the total currently locked
total_locked = ybi_data.back().locked_coins_tally;
@@ -2434,7 +2469,7 @@ bool wallet2::get_yield_summary_info(uint64_t &total_burnt,
yield_per_stake_128 /= ybi_data.back().locked_coins_tally;
yield_per_stake = yield_per_stake_128.convert_to<uint64_t>();
}
/*
// Iterate over the transfers in our wallet
std::map<size_t, size_t> map_payouts;
for (size_t idx = m_transfers.size()-1; idx>0; --idx) {
@@ -2452,7 +2487,7 @@ bool wallet2::get_yield_summary_info(uint64_t &total_burnt,
map_payouts[td.m_td_origin_idx] = idx;
}
}
*/
// Return success to caller
return true;
}
@@ -6921,7 +6956,7 @@ uint64_t wallet2::balance(uint32_t index_major, const std::string& asset_type, b
uint64_t amount = 0;
for (const auto& i : balance_per_subaddress(index_major, asset_type, strict))
amount += i.second;
if (asset_type == "SAL") {
if (index_major == 0 && asset_type == "SAL") {
// Iterate over the locked coins, adding them to the _locked_ balance
for (const auto& i : m_locked_coins)
amount += i.second.m_amount;
@@ -10592,6 +10627,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
break;
case transaction_type::STAKE:
THROW_WALLET_EXCEPTION_IF(dest_asset != "SAL", error::wallet_internal_error, "Yield TX must specify 'SAL' destination asset type");
THROW_WALLET_EXCEPTION_IF(subaddr_account != 0, error::wallet_internal_error, "Staking is only permitted from main account, not secondary accounts");
break;
default:
THROW_WALLET_EXCEPTION(error::wallet_internal_error, "Invalid tx type specified: " + static_cast<uint64_t>(tx_type));
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+7 -1
View File
@@ -1,4 +1,10 @@
de
es
fr
it
ja
jp
nl
pt
ru
sv
zh
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+89
View File
@@ -0,0 +1,89 @@
#!/usr/bin/perl -w -CS
use 5.010;
use strict;
use utf8;
use warnings;
use HTML::Entities;
use XML::LibXML;
use open qw( :std :encoding(UTF-8) );
#Name of the CSV File
my $csvfile = $ARGV[0];
my $lang;
if ($csvfile =~ /salvium_([a-z]{2}).csv/) {
# got a match
$lang = $1;
} else {
die "input language code '$lang' is invalid";
}
# Open the correct input file
open(CSV, $csvfile) or die "Failed to open $csvfile: $!\n";
# Open the correct output file
my $xmlfile = "salvium_$lang.ts";
open(TS, '>', $xmlfile) or die "Failed to open $xmlfile: $!\n";
# Print the preamble
print TS "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE TS>\n<TS version=\"2.1\" language=\"$lang\">\n";
# Print the records
my $context_name = "";
my $first_context = 1;
while (my $csv_line = <CSV>) {
# Split the current line based on "===" delimiter
my @fields = split("===", $csv_line);
if ($fields[0] ne $context_name) {
$context_name = $fields[0];
if ($first_context) {
$first_context = 0;
} else {
print TS "</context>\n";
}
print TS "<context>\n <name>$context_name</name>\n";
}
print TS " <message>\n";
# Split the location entries
my @locations = split(/\^/, $fields[3]);
foreach (@locations) {
if ($_ ne "") {
# Split into filename + line
my($filename, $line) = split(":", $_, 2);
$line =~ s/\\n/\n/g;
$line =~ s/\r\n/\n/g;
$line =~ s/\r//g;
chomp($line);
print TS " <location filename=\"$filename\" line=\"$line\"/>\n";
}
}
# Output source + translation
my $source = $fields[1];
$source =~ s/\\n/\n/g;
$source =~ s/\r\n/\n/g;
$source =~ s/\r//g;
my $translation = $fields[2];
$translation =~ s/\\n/\n/g;
$translation =~ s/\r\n/\n/g;
$translation =~ s/\r//g;
print TS " <source>" . $source . "</source>\n";
if (length($translation)) {
print TS " <translation>" . $translation . "</translation>\n";
} else {
print TS " <translation type=\"unfinished\">" . $translation . "</translation>\n";
}
print TS " </message>\n";
}
# Print the postamble
print TS "</context>\n";
print TS "</TS>\n";
# Close the files
close($xmlfile);
close($csvfile);
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/perl -w -CS
use 5.010;
use strict;
use utf8;
use warnings;
use HTML::Entities;
use XML::LibXML;
use open qw( :std :encoding(UTF-8) );
#Name of the XML File
my $xmlfile = "salvium-en.ts";
my $lang = $ARGV[0];
if (length($lang) != 2) {
die "input language code '$lang' is invalid";
}
my $csvfile = "salvium_$lang.csv";
open(CSV, '>', $csvfile);
#Collect the XML and set nodes
my $dom = XML::LibXML->load_xml(location=>$xmlfile);
foreach my $context ($dom->findnodes('/TS/context')) {
foreach my $message ($context->findnodes('./message')) {
my $source = $message->findvalue('./source');
$source =~ s/\n/\\n/g;
print CSV $context->findvalue('./name') . "===";
print CSV encode_entities($source) . "======";
my @locations = ();
foreach my $location ($message->findnodes('./location')) {
my $temp = $location->getAttribute('filename') . ":" . $location->getAttribute('line');
push(@locations, $temp);
}
print CSV join("^", @locations) . "\n";
}
}
close($csvfile);
+1 -1
View File
@@ -21,7 +21,7 @@ then
languages=""
for language in $(cat translations/ready)
do
languages="$languages translations/monero_$language.ts"
languages="$languages translations/salvium_$language.ts"
done
else
languages="translations/*.ts"