Compare commits

..

7 Commits

9 changed files with 20 additions and 131 deletions

View File

@@ -216,7 +216,7 @@
#define HF_VERSION_ENABLE_ORACLE 2
#define HF_VERSION_SLIPPAGE_YIELD 2
#define TESTNET_VERSION 5
#define TESTNET_VERSION 7
#define STAGENET_VERSION 1
#define PER_KB_FEE_QUANTIZATION_DECIMALS 8

View File

@@ -171,7 +171,7 @@ namespace cryptonote
static const command_line::arg_descriptor<std::string> arg_check_updates = {
"check-updates"
, "Check for new versions of monero: [disabled|notify|download|update]"
, "notify"
, "disabled"
};
static const command_line::arg_descriptor<bool> arg_fluffy_blocks = {
"fluffy-blocks"
@@ -519,6 +519,12 @@ namespace cryptonote
return false;
}
if (m_nettype == STAGENET) {
folder /= std::to_string(STAGENET_VERSION);
} else if (m_nettype == TESTNET) {
folder /= std::to_string(TESTNET_VERSION);
}
folder /= db->get_db_name();
MGINFO("Loading blockchain from folder " << folder.string() << " ...");

View File

@@ -442,7 +442,7 @@ namespace cryptonote
// Create the TX output for this refund
tx_out out;
//cryptonote::set_tx_out(entry.amount_burnt, entry.source_asset, 0, out_eph_public_key, false, crypto::view_tag{}, out);
cryptonote::set_tx_out(entry.amount_burnt, entry.source_asset, 0, entry.return_address, false, crypto::view_tag{}, out);
cryptonote::set_tx_out(entry.amount_burnt, entry.source_asset, CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, entry.return_address, false, crypto::view_tag{}, out);
additional_tx_public_keys.push_back(entry.return_pubkey);
tx.vout.push_back(out);
} else {
@@ -467,7 +467,7 @@ namespace cryptonote
// Create the TX output for this conversion
tx_out out;
//cryptonote::set_tx_out(amount_minted, entry.destination_asset, 0, out_eph_public_key, false, crypto::view_tag{}, out);
cryptonote::set_tx_out(amount_minted, entry.destination_asset, 0, entry.return_address, false, crypto::view_tag{}, out);
cryptonote::set_tx_out(amount_minted, entry.destination_asset, CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, entry.return_address, false, crypto::view_tag{}, out);
additional_tx_public_keys.push_back(entry.return_pubkey);
tx.vout.push_back(out);
}
@@ -480,7 +480,7 @@ namespace cryptonote
// Create the TX output for this refund
tx_out out;
//cryptonote::set_tx_out(entry.amount_burnt, entry.source_asset, 0, out_eph_public_key, false, crypto::view_tag{}, out);
cryptonote::set_tx_out(entry.amount_burnt, entry.source_asset, 0, entry.return_address, false, crypto::view_tag{}, out);
cryptonote::set_tx_out(entry.amount_burnt, entry.source_asset, CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, entry.return_address, false, crypto::view_tag{}, out);
additional_tx_public_keys.push_back(entry.return_pubkey);
tx.vout.push_back(out);
}
@@ -503,7 +503,7 @@ namespace cryptonote
CHECK_AND_ASSERT_MES(r, false, "while creating outs: failed to derive_public_key(" << derivation << ", " << 0 << ", "<< miner_address.m_spend_public_key << ")");
tx_out out_miner;
cryptonote::set_tx_out(slippage_miner, "SAL", 0, out_eph_public_key, false, crypto::view_tag{}, out_miner);
cryptonote::set_tx_out(slippage_miner, "SAL", CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, out_eph_public_key, false, crypto::view_tag{}, out_miner);
tx.vout.push_back(out_miner);
// Add a payout for the treasury
@@ -517,7 +517,7 @@ namespace cryptonote
uint64_t slippage_treasury = slippage_miner >> 1;
tx_out out_treasury;
cryptonote::set_tx_out(slippage_treasury, "SAL", 0, out_eph_public_key_treasury, false, crypto::view_tag{}, out_treasury);
cryptonote::set_tx_out(slippage_treasury, "SAL", CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, out_eph_public_key_treasury, false, crypto::view_tag{}, out_treasury);
tx.vout.push_back(out_treasury);
}

View File

@@ -1,5 +1,5 @@
#define DEF_SALVIUM_VERSION_TAG "7f6b8da"
#define DEF_SALVIUM_VERSION "0.2.4"
#define DEF_SALVIUM_VERSION "0.2.7"
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
#define DEF_MONERO_VERSION "0.18.3.3"
#define DEF_MONERO_RELEASE_NAME "Zero"

View File

@@ -211,38 +211,6 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback
// TODO;
}
// Light wallet callbacks
virtual void on_lw_new_block(uint64_t height)
{
if (m_listener) {
m_listener->newBlock(height);
}
}
virtual void on_lw_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount)
{
if (m_listener) {
std::string tx_hash = epee::string_tools::pod_to_hex(txid);
m_listener->moneyReceived(tx_hash, amount);
}
}
virtual void on_lw_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount)
{
if (m_listener) {
std::string tx_hash = epee::string_tools::pod_to_hex(txid);
m_listener->unconfirmedMoneyReceived(tx_hash, amount);
}
}
virtual void on_lw_money_spent(uint64_t height, const crypto::hash &txid, uint64_t amount)
{
if (m_listener) {
std::string tx_hash = epee::string_tools::pod_to_hex(txid);
m_listener->moneySpent(tx_hash, amount);
}
}
virtual void on_device_button_request(uint64_t code)
{
if (m_listener) {
@@ -952,42 +920,11 @@ string WalletImpl::keysFilename() const
bool WalletImpl::init(const std::string &daemon_address, uint64_t upper_transaction_size_limit, const std::string &daemon_username, const std::string &daemon_password, bool use_ssl, bool lightWallet, const std::string &proxy_address)
{
clearStatus();
m_wallet->set_light_wallet(lightWallet);
if(daemon_username != "")
m_daemon_login.emplace(daemon_username, daemon_password);
return doInit(daemon_address, proxy_address, upper_transaction_size_limit, use_ssl);
}
bool WalletImpl::lightWalletLogin(bool &isNewWallet) const
{
return m_wallet->light_wallet_login(isNewWallet);
}
bool WalletImpl::lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status)
{
try
{
tools::COMMAND_RPC_IMPORT_WALLET_REQUEST::response response;
if(!m_wallet->light_wallet_import_wallet_request(response)){
setStatusError(tr("Failed to send import wallet request"));
return false;
}
fee = response.import_fee;
payment_id = response.payment_id;
new_request = response.new_request;
request_fulfilled = response.request_fulfilled;
payment_address = response.payment_address;
status = response.status;
}
catch (const std::exception &e)
{
LOG_ERROR("Error sending import wallet request: " << e.what());
setStatusError(e.what());
return false;
}
return true;
}
void WalletImpl::setRefreshFromBlockHeight(uint64_t refresh_from_block_height)
{
m_wallet->set_refresh_from_block_height(refresh_from_block_height);
@@ -1020,9 +957,6 @@ uint64_t WalletImpl::unlockedBalance(uint32_t accountIndex) const
uint64_t WalletImpl::blockChainHeight() const
{
if(m_wallet->light_wallet()) {
return m_wallet->get_light_wallet_scanned_block_height();
}
return m_wallet->get_blockchain_current_height();
}
uint64_t WalletImpl::approximateBlockChainHeight() const
@@ -1037,9 +971,6 @@ uint64_t WalletImpl::estimateBlockChainHeight() const
uint64_t WalletImpl::daemonBlockChainHeight() const
{
if(m_wallet->light_wallet()) {
return m_wallet->get_light_wallet_scanned_block_height();
}
if (!m_is_connected)
return 0;
std::string err;
@@ -1056,9 +987,6 @@ uint64_t WalletImpl::daemonBlockChainHeight() const
uint64_t WalletImpl::daemonBlockChainTargetHeight() const
{
if(m_wallet->light_wallet()) {
return m_wallet->get_light_wallet_blockchain_height();
}
if (!m_is_connected)
return 0;
std::string err;
@@ -2183,13 +2111,13 @@ Wallet::ConnectionStatus WalletImpl::connected() const
m_is_connected = m_wallet->check_connection(&version, NULL, DEFAULT_CONNECTION_TIMEOUT_MILLIS, &wallet_is_outdated, &daemon_is_outdated);
if (!m_is_connected)
{
if (!m_wallet->light_wallet() && (wallet_is_outdated || daemon_is_outdated))
if (wallet_is_outdated || daemon_is_outdated)
return Wallet::ConnectionStatus_WrongVersion;
else
return Wallet::ConnectionStatus_Disconnected;
}
// Version check is not implemented in light wallets nodes/wallets
if (!m_wallet->light_wallet() && (version >> 16) != CORE_RPC_VERSION_MAJOR)
if ((version >> 16) != CORE_RPC_VERSION_MAJOR)
return Wallet::ConnectionStatus_WrongVersion;
return Wallet::ConnectionStatus_Connected;
}
@@ -2283,7 +2211,7 @@ void WalletImpl::doRefresh()
LOG_PRINT_L3(__FUNCTION__ << ": doRefresh, rescan = "<<rescan);
// Syncing daemon and refreshing wallet simultaneously is very resource intensive.
// Disable refresh if wallet is disconnected or daemon isn't synced.
if (m_wallet->light_wallet() || daemonSynced()) {
if (daemonSynced()) {
if(rescan)
m_wallet->rescan_blockchain(false);
m_wallet->refresh(trustedDaemon());

View File

@@ -207,8 +207,6 @@ public:
virtual bool 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) override;
virtual std::string make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error) const override;
virtual std::string getDefaultDataDir() const override;
virtual bool lightWalletLogin(bool &isNewWallet) const override;
virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) override;
virtual bool blackballOutputs(const std::vector<std::string> &outputs, bool add) override;
virtual bool blackballOutput(const std::string &amount, const std::string &offset) override;
virtual bool unblackballOutput(const std::string &amount, const std::string &offset) override;

View File

@@ -1066,12 +1066,6 @@ struct Wallet
//! secondary key reuse mitigation
virtual void keyReuseMitigation2(bool mitigation) = 0;
//! Light wallet authenticate and login
virtual bool lightWalletLogin(bool &isNewWallet) const = 0;
//! Initiates a light wallet import wallet request
virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) = 0;
//! locks/unlocks the keys file; returns true on success
virtual bool lockKeysFile() = 0;
virtual bool unlockKeysFile() = 0;

View File

@@ -9209,7 +9209,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
{
MINFO("Using it");
//req.outputs.push_back({amount, out, true}); // Rings are stored referencing global output IDs
add_output_to_lists({amount, out});
add_output_to_lists({amount, out, true});
++num_found;
seen_indices.emplace(out);
if (out == td.m_global_output_index)
@@ -9497,7 +9497,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
break;
}
}
THROW_WALLET_EXCEPTION_IF(!found, error::wallet_internal_error, "Falied to find existing ring output in daemon out data");
THROW_WALLET_EXCEPTION_IF(!found, error::wallet_internal_error, "Failed to find existing ring output in daemon out data");
}
}
}

View File

@@ -1046,14 +1046,6 @@ private:
bool is_deterministic() const;
bool get_seed(epee::wipeable_string& electrum_words, const epee::wipeable_string &passphrase = epee::wipeable_string()) const;
/*!
* \brief Checks if light wallet. A light wallet sends view key to a server where the blockchain is scanned.
*/
bool light_wallet() const { return m_light_wallet; }
void set_light_wallet(bool light_wallet) { m_light_wallet = light_wallet; }
uint64_t get_light_wallet_scanned_block_height() const { return m_light_wallet_scanned_block_height; }
uint64_t get_light_wallet_blockchain_height() const { return m_light_wallet_blockchain_height; }
/*!
* \brief Gets the seed language
*/
@@ -1187,7 +1179,7 @@ private:
void get_unconfirmed_payments_out(std::list<std::pair<crypto::hash,wallet2::unconfirmed_transfer_details>>& unconfirmed_payments, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
void get_unconfirmed_payments(std::list<std::pair<crypto::hash,wallet2::pool_payment_details>>& unconfirmed_payments, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
uint64_t get_blockchain_current_height() const { return m_light_wallet_blockchain_height ? m_light_wallet_blockchain_height : m_blockchain.size(); }
uint64_t get_blockchain_current_height() const { return m_blockchain.size(); }
void rescan_spent();
void rescan_blockchain(bool hard, bool refresh = true, bool keep_key_images = false);
bool is_transfer_unlocked(const transfer_details& td);
@@ -1649,24 +1641,6 @@ private:
}
template<typename T> void handle_payment_changes(const T &res, std::false_type) {}
// Light wallet specific functions
// fetch unspent outs from lw node and store in m_transfers
void light_wallet_get_unspent_outs();
// fetch txs and store in m_payments
void light_wallet_get_address_txs();
// get_address_info
bool light_wallet_get_address_info(tools::COMMAND_RPC_GET_ADDRESS_INFO::response &response);
// Login. new_address is true if address hasn't been used on lw node before.
bool light_wallet_login(bool &new_address);
// Send an import request to lw node. returns info about import fee, address and payment_id
bool light_wallet_import_wallet_request(tools::COMMAND_RPC_IMPORT_WALLET_REQUEST::response &response);
// get random outputs from light wallet server
void light_wallet_get_outs(std::vector<std::vector<get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count);
// Parse rct string
bool light_wallet_parse_rct_str(const std::string& rct_string, const crypto::public_key& tx_pub_key, uint64_t internal_output_index, rct::key& decrypted_mask, rct::key& rct_commit, bool decrypt) const;
// check if key image is ours
bool light_wallet_key_image_is_ours(const crypto::key_image& key_image, const crypto::public_key& tx_public_key, uint64_t out_index);
/*
* "attributes" are a mechanism to store an arbitrary number of string values
* on the level of the wallet as a whole, identified by keys. Their introduction,
@@ -2000,17 +1974,6 @@ private:
// Aux transaction data from device
serializable_unordered_map<crypto::hash, std::string> m_tx_device;
// Light wallet
bool m_light_wallet; /* sends view key to daemon for scanning */
uint64_t m_light_wallet_scanned_block_height;
uint64_t m_light_wallet_blockchain_height;
uint64_t m_light_wallet_per_kb_fee = FEE_PER_KB;
bool m_light_wallet_connected;
uint64_t m_light_wallet_balance;
uint64_t m_light_wallet_unlocked_balance;
// Light wallet info needed to populate m_payment requires 2 separate api calls (get_address_txs and get_unspent_outs)
// We save the info from the first call in m_light_wallet_address_txs for easier lookup.
std::unordered_map<crypto::hash, address_tx> m_light_wallet_address_txs;
// store calculated key image for faster lookup
serializable_unordered_map<crypto::public_key, serializable_map<uint64_t, crypto::key_image> > m_key_image_cache;