mirror of
https://codeberg.org/nahuhh/wownero
synced 2026-11-25 13:54:21 +01:00
initial commit
This commit is contained in:
+24
-46
@@ -102,9 +102,9 @@ using namespace cryptonote;
|
||||
// used to target a given block weight (additional outputs may be added on top to build fee)
|
||||
#define TX_WEIGHT_TARGET(bytes) (bytes*2/3)
|
||||
|
||||
#define UNSIGNED_TX_PREFIX "Monero unsigned tx set\004"
|
||||
#define SIGNED_TX_PREFIX "Monero signed tx set\004"
|
||||
#define MULTISIG_UNSIGNED_TX_PREFIX "Monero multisig unsigned tx set\001"
|
||||
#define UNSIGNED_TX_PREFIX "Wownero unsigned tx set\004"
|
||||
#define SIGNED_TX_PREFIX "Wownero signed tx set\004"
|
||||
#define MULTISIG_UNSIGNED_TX_PREFIX "Wownero multisig unsigned tx set\001"
|
||||
|
||||
#define RECENT_OUTPUT_RATIO (0.5) // 50% of outputs are from the recent zone
|
||||
#define RECENT_OUTPUT_DAYS (1.8) // last 1.8 day makes up the recent zone (taken from monerolink.pdf, Miller et al)
|
||||
@@ -118,11 +118,11 @@ using namespace cryptonote;
|
||||
#define SUBADDRESS_LOOKAHEAD_MAJOR 50
|
||||
#define SUBADDRESS_LOOKAHEAD_MINOR 200
|
||||
|
||||
#define KEY_IMAGE_EXPORT_FILE_MAGIC "Monero key image export\003"
|
||||
#define KEY_IMAGE_EXPORT_FILE_MAGIC "Wownero key image export\003"
|
||||
|
||||
#define MULTISIG_EXPORT_FILE_MAGIC "Monero multisig export\001"
|
||||
#define MULTISIG_EXPORT_FILE_MAGIC "Wownero multisig export\001"
|
||||
|
||||
#define OUTPUT_EXPORT_FILE_MAGIC "Monero output export\004"
|
||||
#define OUTPUT_EXPORT_FILE_MAGIC "Wownero output export\004"
|
||||
|
||||
#define SEGREGATION_FORK_HEIGHT 99999999
|
||||
#define TESTNET_SEGREGATION_FORK_HEIGHT 99999999
|
||||
@@ -137,14 +137,14 @@ using namespace cryptonote;
|
||||
#define DEFAULT_MIN_OUTPUT_COUNT 5
|
||||
#define DEFAULT_MIN_OUTPUT_VALUE (2*COIN)
|
||||
|
||||
#define DEFAULT_INACTIVITY_LOCK_TIMEOUT 90 // a minute and a half
|
||||
#define DEFAULT_INACTIVITY_LOCK_TIMEOUT 300 // 5 minutes
|
||||
|
||||
#define IGNORE_LONG_PAYMENT_ID_FROM_BLOCK_VERSION 12
|
||||
|
||||
static const std::string MULTISIG_SIGNATURE_MAGIC = "SigMultisigPkV1";
|
||||
static const std::string MULTISIG_EXTRA_INFO_MAGIC = "MultisigxV1";
|
||||
|
||||
static const std::string ASCII_OUTPUT_MAGIC = "MoneroAsciiDataV1";
|
||||
static const std::string ASCII_OUTPUT_MAGIC = "WowneroAsciiDataV1";
|
||||
|
||||
boost::mutex tools::wallet2::default_daemon_address_lock;
|
||||
std::string tools::wallet2::default_daemon_address = "";
|
||||
@@ -156,7 +156,7 @@ namespace
|
||||
boost::filesystem::path dir = tools::get_default_data_dir();
|
||||
// remove .bitmonero, replace with .shared-ringdb
|
||||
dir = dir.remove_filename();
|
||||
dir /= ".shared-ringdb";
|
||||
dir /= ".wow-shared-ringdb";
|
||||
return dir.string();
|
||||
}
|
||||
|
||||
@@ -1142,7 +1142,7 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended):
|
||||
m_refresh_from_block_height(0),
|
||||
m_explicit_refresh_from_block_height(true),
|
||||
m_confirm_non_default_ring_size(true),
|
||||
m_ask_password(AskPasswordToDecrypt),
|
||||
m_ask_password(AskPasswordOnAction),
|
||||
m_min_output_count(0),
|
||||
m_min_output_value(0),
|
||||
m_merge_destinations(false),
|
||||
@@ -1150,15 +1150,15 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended):
|
||||
m_confirm_backlog_threshold(0),
|
||||
m_confirm_export_overwrite(true),
|
||||
m_auto_low_priority(true),
|
||||
m_segregate_pre_fork_outputs(true),
|
||||
m_key_reuse_mitigation2(true),
|
||||
m_segregate_pre_fork_outputs(false),
|
||||
m_key_reuse_mitigation2(false),
|
||||
m_segregation_height(0),
|
||||
m_ignore_fractional_outputs(true),
|
||||
m_ignore_outputs_above(MONEY_SUPPLY),
|
||||
m_ignore_outputs_below(0),
|
||||
m_track_uses(false),
|
||||
m_inactivity_lock_timeout(DEFAULT_INACTIVITY_LOCK_TIMEOUT),
|
||||
m_setup_background_mining(BackgroundMiningMaybe),
|
||||
m_setup_background_mining(BackgroundMiningNo),
|
||||
m_persistent_rpc_client_id(false),
|
||||
m_auto_mine_for_rpc_payment_threshold(-1.0f),
|
||||
m_is_initialized(false),
|
||||
@@ -1765,8 +1765,8 @@ void wallet2::scan_output(const cryptonote::transaction &tx, bool miner_tx, cons
|
||||
if (!m_encrypt_keys_after_refresh)
|
||||
{
|
||||
boost::optional<epee::wipeable_string> pwd = m_callback->on_get_password(pool ? "output found in pool" : "output received");
|
||||
THROW_WALLET_EXCEPTION_IF(!pwd, error::password_needed, tr("Password is needed to compute key image for incoming monero"));
|
||||
THROW_WALLET_EXCEPTION_IF(!verify_password(*pwd), error::password_needed, tr("Invalid password: password is needed to compute key image for incoming monero"));
|
||||
THROW_WALLET_EXCEPTION_IF(!pwd, error::password_needed, tr("Password is needed to compute key image for incoming wownero"));
|
||||
THROW_WALLET_EXCEPTION_IF(!verify_password(*pwd), error::password_needed, tr("Invalid password: password is needed to compute key image for incoming wownero"));
|
||||
decrypt_keys(*pwd);
|
||||
m_encrypt_keys_after_refresh = *pwd;
|
||||
}
|
||||
@@ -4002,7 +4002,7 @@ bool wallet2::load_keys(const std::string& keys_file_name, const epee::wipeable_
|
||||
m_ignore_outputs_below = 0;
|
||||
m_track_uses = false;
|
||||
m_inactivity_lock_timeout = DEFAULT_INACTIVITY_LOCK_TIMEOUT;
|
||||
m_setup_background_mining = BackgroundMiningMaybe;
|
||||
m_setup_background_mining = BackgroundMiningNo;
|
||||
m_subaddress_lookahead_major = SUBADDRESS_LOOKAHEAD_MAJOR;
|
||||
m_subaddress_lookahead_minor = SUBADDRESS_LOOKAHEAD_MINOR;
|
||||
m_original_keys_available = false;
|
||||
@@ -6114,8 +6114,7 @@ bool wallet2::is_tx_spendtime_unlocked(uint64_t unlock_time, uint64_t block_heig
|
||||
uint64_t current_time = static_cast<uint64_t>(time(NULL));
|
||||
// XXX: this needs to be fast, so we'd need to get the starting heights
|
||||
// from the daemon to be correct once voting kicks in
|
||||
uint64_t v2height = m_nettype == TESTNET ? 624634 : m_nettype == STAGENET ? 32000 : 1009827;
|
||||
uint64_t leeway = block_height < v2height ? CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1 : CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2;
|
||||
uint64_t leeway = CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2;
|
||||
if(current_time + leeway >= unlock_time)
|
||||
return true;
|
||||
else
|
||||
@@ -7262,20 +7261,14 @@ int wallet2::get_fee_algorithm()
|
||||
uint64_t wallet2::get_min_ring_size()
|
||||
{
|
||||
if (use_fork_rules(8, 10))
|
||||
return 11;
|
||||
if (use_fork_rules(7, 10))
|
||||
return 7;
|
||||
if (use_fork_rules(6, 10))
|
||||
return 5;
|
||||
if (use_fork_rules(2, 10))
|
||||
return 3;
|
||||
return 22;
|
||||
return 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
uint64_t wallet2::get_max_ring_size()
|
||||
{
|
||||
if (use_fork_rules(8, 10))
|
||||
return 11;
|
||||
return 22;
|
||||
return 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -11821,18 +11814,7 @@ uint64_t wallet2::get_daemon_blockchain_target_height(string &err)
|
||||
|
||||
uint64_t wallet2::get_approximate_blockchain_height() const
|
||||
{
|
||||
// time of v2 fork
|
||||
const time_t fork_time = m_nettype == TESTNET ? 1448285909 : m_nettype == STAGENET ? 1520937818 : 1458748658;
|
||||
// v2 fork block
|
||||
const uint64_t fork_block = m_nettype == TESTNET ? 624634 : m_nettype == STAGENET ? 32000 : 1009827;
|
||||
// avg seconds per block
|
||||
const int seconds_per_block = DIFFICULTY_TARGET_V2;
|
||||
// Calculated blockchain height
|
||||
uint64_t approx_blockchain_height = fork_block + (time(NULL) - fork_time)/seconds_per_block;
|
||||
// testnet got some huge rollbacks, so the estimation is way off
|
||||
static const uint64_t approximate_testnet_rolled_back_blocks = 303967;
|
||||
if (m_nettype == TESTNET && approx_blockchain_height > approximate_testnet_rolled_back_blocks)
|
||||
approx_blockchain_height -= approximate_testnet_rolled_back_blocks;
|
||||
uint64_t approx_blockchain_height = m_nettype == TESTNET ? 0 : (time(NULL) - 1522624244)/322;
|
||||
LOG_PRINT_L2("Calculated blockchain height: " << approx_blockchain_height);
|
||||
return approx_blockchain_height;
|
||||
}
|
||||
@@ -13144,7 +13126,7 @@ std::string wallet2::make_uri(const std::string &address, const std::string &pay
|
||||
}
|
||||
}
|
||||
|
||||
std::string uri = "monero:" + address;
|
||||
std::string uri = "wownero:" + address;
|
||||
unsigned int n_fields = 0;
|
||||
|
||||
if (!payment_id.empty())
|
||||
@@ -13173,13 +13155,13 @@ std::string wallet2::make_uri(const std::string &address, const std::string &pay
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error)
|
||||
{
|
||||
if (uri.substr(0, 7) != "monero:")
|
||||
if (uri.substr(0, 8) != "wownero:")
|
||||
{
|
||||
error = std::string("URI has wrong scheme (expected \"monero:\"): ") + uri;
|
||||
error = std::string("URI has wrong scheme (expected \"wownero:\"): ") + uri;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string remainder = uri.substr(7);
|
||||
std::string remainder = uri.substr(8);
|
||||
const char *ptr = strchr(remainder.c_str(), '?');
|
||||
address = ptr ? remainder.substr(0, ptr-remainder.c_str()) : remainder;
|
||||
|
||||
@@ -13449,10 +13431,6 @@ uint64_t wallet2::get_segregation_fork_height() const
|
||||
{
|
||||
// All four MoneroPulse domains have DNSSEC on and valid
|
||||
static const std::vector<std::string> dns_urls = {
|
||||
"segheights.moneropulse.org",
|
||||
"segheights.moneropulse.net",
|
||||
"segheights.moneropulse.co",
|
||||
"segheights.moneropulse.se"
|
||||
};
|
||||
|
||||
const uint64_t current_height = get_blockchain_current_height();
|
||||
|
||||
Reference in New Issue
Block a user