mirror of https://github.com/oxen-io/oxen-core.git
Merge commit 'f3fddd935fa98f8950f76132cb7ba7bf35df3cb3' into MergeUpstream3
This commit is contained in:
commit
232975167f
|
@ -135,9 +135,9 @@ $(1)_config_env+=$($(1)_config_env_$(host_arch)_$(host_os)) $($(1)_config_env_$(
|
|||
|
||||
$(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig
|
||||
$(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig
|
||||
$(1)_config_env+=PATH=$(build_prefix)/bin:$(PATH)
|
||||
$(1)_build_env+=PATH=$(build_prefix)/bin:$(PATH)
|
||||
$(1)_stage_env+=PATH=$(build_prefix)/bin:$(PATH)
|
||||
$(1)_config_env+=PATH="$(build_prefix)/bin:$(PATH)"
|
||||
$(1)_build_env+=PATH="$(build_prefix)/bin:$(PATH)"
|
||||
$(1)_stage_env+=PATH="$(build_prefix)/bin:$(PATH)"
|
||||
$(1)_autoconf=./configure --host=$($($(1)_type)_host) --disable-dependency-tracking --prefix=$($($(1)_type)_prefix) $$($(1)_config_opts) CC="$$($(1)_cc)" CXX="$$($(1)_cxx)"
|
||||
|
||||
ifneq ($($(1)_nm),)
|
||||
|
|
|
@ -354,7 +354,7 @@ namespace cryptonote
|
|||
if (version >= 6 && version != hshd.top_version)
|
||||
{
|
||||
if (version < hshd.top_version && version == m_core.get_ideal_hard_fork_version())
|
||||
MCLOG_RED(el::Level::Warning, "global", context << " peer claims higher version that we think (" <<
|
||||
MCLOG_RED(el::Level::Warning, "global", context << " peer claims higher version than we think (" <<
|
||||
(unsigned)hshd.top_version << " for " << (hshd.current_height - 1) << " instead of " << (unsigned)version <<
|
||||
") - we may be forked from the network and a software upgrade may be needed");
|
||||
return false;
|
||||
|
|
|
@ -480,15 +480,14 @@ namespace cryptonote { namespace rpc {
|
|||
return res;
|
||||
}
|
||||
|
||||
size_t pruned_size = 0, unpruned_size = 0, ntxes = 0;
|
||||
size_t size = 0, ntxes = 0;
|
||||
res.blocks.reserve(bs.size());
|
||||
res.output_indices.reserve(bs.size());
|
||||
for(auto& bd: bs)
|
||||
{
|
||||
res.blocks.resize(res.blocks.size()+1);
|
||||
res.blocks.back().block = bd.first.first;
|
||||
pruned_size += bd.first.first.size();
|
||||
unpruned_size += bd.first.first.size();
|
||||
size += bd.first.first.size();
|
||||
res.output_indices.push_back(GET_BLOCKS_FAST::block_output_indices());
|
||||
ntxes += bd.second.size();
|
||||
res.output_indices.back().indices.reserve(1 + bd.second.size());
|
||||
|
@ -497,11 +496,10 @@ namespace cryptonote { namespace rpc {
|
|||
res.blocks.back().txs.reserve(bd.second.size());
|
||||
for (std::vector<std::pair<crypto::hash, cryptonote::blobdata>>::iterator i = bd.second.begin(); i != bd.second.end(); ++i)
|
||||
{
|
||||
unpruned_size += i->second.size();
|
||||
res.blocks.back().txs.push_back(std::move(i->second));
|
||||
res.blocks.back().txs.push_back({std::move(i->second), crypto::null_hash});
|
||||
i->second.clear();
|
||||
i->second.shrink_to_fit();
|
||||
pruned_size += res.blocks.back().txs.back().size();
|
||||
size += res.blocks.back().txs.back().size();
|
||||
}
|
||||
|
||||
const size_t n_txes_to_lookup = bd.second.size() + (req.no_miner_tx ? 0 : 1);
|
||||
|
@ -519,7 +517,7 @@ namespace cryptonote { namespace rpc {
|
|||
}
|
||||
}
|
||||
|
||||
MDEBUG("on_get_blocks: " << bs.size() << " blocks, " << ntxes << " txes, pruned size " << pruned_size << ", unpruned size " << unpruned_size);
|
||||
MDEBUG("on_get_blocks: " << bs.size() << " blocks, " << ntxes << " txes, size " << size);
|
||||
res.status = STATUS_OK;
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -445,7 +445,6 @@ KV_SERIALIZE_MAP_CODE_END()
|
|||
|
||||
KV_SERIALIZE_MAP_CODE_BEGIN(GET_BLOCK::response)
|
||||
KV_SERIALIZE(block_header)
|
||||
KV_SERIALIZE(miner_tx_hash)
|
||||
KV_SERIALIZE(tx_hashes)
|
||||
KV_SERIALIZE(status)
|
||||
KV_SERIALIZE(blob)
|
||||
|
|
|
@ -851,7 +851,6 @@ namespace rpc {
|
|||
{
|
||||
std::string status; // General RPC error code. "OK" means everything looks good.
|
||||
block_header_response block_header; // A structure containing block header information. See get_last_block_header.
|
||||
std::string miner_tx_hash; // Miner transaction information
|
||||
std::vector<std::string> tx_hashes; // List of hashes of non-coinbase transactions in the block. If there are no other transactions, this will be an empty list.
|
||||
std::string blob; // Hexadecimal blob of block information.
|
||||
std::string json; // JSON formatted block details.
|
||||
|
|
|
@ -168,8 +168,8 @@ namespace
|
|||
const char* USAGE_PAYMENT_ID("payment_id");
|
||||
const char* USAGE_TRANSFER("transfer [index=<N1>[,<N2>,...]] [blink|unimportant] (<URI> | <address> <amount>) [<payment_id>]");
|
||||
const char* USAGE_LOCKED_TRANSFER("locked_transfer [index=<N1>[,<N2>,...]] [<priority>] (<URI> | <addr> <amount>) <lockblocks> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_LOCKED_SWEEP_ALL("locked_sweep_all [index=<N1>[,<N2>,...]] [<priority>] [<address>] <lockblocks> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_SWEEP_ALL("sweep_all [index=<N1>[,<N2>,...]] [blink|unimportant] [outputs=<N>] [<address> [<payment_id (obsolete)>]] [use_v1_tx]");
|
||||
const char* USAGE_LOCKED_SWEEP_ALL("locked_sweep_all [index=<N1>[,<N2>,...] | index=all] [<priority>] [<address>] <lockblocks> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_SWEEP_ALL("sweep_all [index=<N1>[,<N2>,...] | index=all] [blink|unimportant] [outputs=<N>] [<address> [<payment_id (obsolete)>]] [use_v1_tx]");
|
||||
const char* USAGE_SWEEP_BELOW("sweep_below <amount_threshold> [index=<N1>[,<N2>,...]] [blink|unimportant] [<address> [<payment_id (obsolete)>]]");
|
||||
const char* USAGE_SWEEP_SINGLE("sweep_single [blink|unimportant] [outputs=<N>] <key_image> <address> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_SIGN_TRANSFER("sign_transfer [export_raw]");
|
||||
|
@ -2682,13 +2682,13 @@ simple_wallet::simple_wallet()
|
|||
m_cmd_binder.set_handler("locked_sweep_all",
|
||||
boost::bind(&simple_wallet::on_command, this, &simple_wallet::locked_sweep_all,_1),
|
||||
tr(USAGE_LOCKED_SWEEP_ALL),
|
||||
tr("Send all unlocked balance to an address and lock it for <lockblocks> (max. 1000000).If no address is specified the address of the currently selected account will be used. If the parameter \"index<N1>[,<N2>,...]\" is specified, the wallet sweeps outputs received by those address indices. If omitted, the wallet randomly chooses an address index to be used. <priority> is the priority of the sweep. The higher the priority, the higher the transaction fee. Valid values in priority order (from lowest to highest) are: unimportant, normal, elevated, priority. If omitted, the default value (see the command \"set priority\") is used."));
|
||||
tr("Send all unlocked balance to an address and lock it for <lockblocks> (max. 1000000). If no address is specified the address of the currently selected account will be used. If the parameter \"index<N1>[,<N2>,...]\" or \"index=all\" is specified, the wallet sweeps outputs received by those address indices. If omitted, the wallet randomly chooses an address index to be used. <priority> is the priority of the sweep. The higher the priority, the higher the transaction fee. Valid values in priority order (from lowest to highest) are: unimportant, normal, elevated, priority. If omitted, the default value (see the command \"set priority\") is used."));
|
||||
m_cmd_binder.set_handler("sweep_unmixable",
|
||||
boost::bind(&simple_wallet::on_command, this, &simple_wallet::sweep_unmixable, _1),
|
||||
tr("Deprecated"));
|
||||
m_cmd_binder.set_handler("sweep_all", boost::bind(&simple_wallet::sweep_all, this, _1),
|
||||
tr(USAGE_SWEEP_ALL),
|
||||
tr("Send all unlocked balance to an address.If no address is specified the address of the currently selected account will be used. If the parameter \"index<N1>[,<N2>,...]\" is specified, the wallet sweeps outputs received by those address indices. If omitted, the wallet randomly chooses an address index to be used. If the parameter \"outputs=<N>\" is specified and N > 0, wallet splits the transaction into N even outputs."
|
||||
tr("Send all unlocked balance to an address.If no address is specified the address of the currently selected account will be used. If the parameter \"index<N1>[,<N2>,...]\" or \"index=all\" is specified, the wallet sweeps outputs received by those address indices. If omitted, the wallet randomly chooses an address index to be used. If the parameter \"outputs=<N>\" is specified and N > 0, wallet splits the transaction into N even outputs."
|
||||
" If \"use_v1_tx\" is placed at the end, sweep_all will include version 1 transactions into the sweeping process as well, otherwise exclude them"
|
||||
));
|
||||
m_cmd_binder.set_handler("sweep_below",
|
||||
|
@ -4952,7 +4952,7 @@ void simple_wallet::on_refresh_finished(uint64_t start_height, uint64_t fetched_
|
|||
const uint64_t dh = m_wallet->get_daemon_blockchain_height(err);
|
||||
if (err.empty() && rfbh > dh)
|
||||
{
|
||||
message_writer(console_color_yellow, false) << tr("The wallet's refresh-from-block-height setting is higher than the daemon's height: this may mean your wallet will skip over transactions");
|
||||
message_writer(epee::console_color_yellow, false) << tr("The wallet's refresh-from-block-height setting is higher than the daemon's height: this may mean your wallet will skip over transactions");
|
||||
}
|
||||
|
||||
// Key image sync after the first refresh
|
||||
|
@ -5542,12 +5542,17 @@ static bool locked_blocks_arg_valid(const std::string& arg, uint64_t& duration)
|
|||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
static bool parse_subaddr_indices_and_priority(tools::wallet2 &wallet, std::vector<std::string> &args, std::set<uint32_t> &subaddr_indices, uint32_t &priority)
|
||||
static bool parse_subaddr_indices_and_priority(tools::wallet2 &wallet, std::vector<std::string> &args, std::set<uint32_t> &subaddr_indices, uint32_t &priority, uint32_t subaddress_account, bool allow_parse_all_argument = false)
|
||||
{
|
||||
if (args.size() > 0 && args[0].substr(0, 6) == "index=")
|
||||
{
|
||||
std::string parse_subaddr_err;
|
||||
if (!tools::parse_subaddress_indices(args[0], subaddr_indices, &parse_subaddr_err))
|
||||
if (allow_parse_all_argument && args[0] == "index=all")
|
||||
{
|
||||
for (uint32_t i = 0; i < wallet.get_num_subaddresses(subaddress_account); ++i)
|
||||
subaddr_indices.insert(i);
|
||||
}
|
||||
else if (!tools::parse_subaddress_indices(args[0], subaddr_indices, &parse_subaddr_err))
|
||||
{
|
||||
fail_msg_writer() << parse_subaddr_err;
|
||||
return false;
|
||||
|
@ -5790,7 +5795,7 @@ bool simple_wallet::transfer_main(Transfer transfer_type, const std::vector<std:
|
|||
std::vector<std::string> local_args = args_;
|
||||
uint32_t priority = 0;
|
||||
std::set<uint32_t> subaddr_indices = {};
|
||||
if (!parse_subaddr_indices_and_priority(*m_wallet, local_args, subaddr_indices, priority)) return false;
|
||||
if (!parse_subaddr_indices_and_priority(*m_wallet, local_args, subaddr_indices, m_current_subaddress_account, priority)) return false;
|
||||
|
||||
const size_t min_args = (transfer_type == Transfer::Locked) ? 2 : 1;
|
||||
if(local_args.size() < min_args)
|
||||
|
@ -6061,7 +6066,7 @@ bool simple_wallet::stake(const std::vector<std::string> &args_)
|
|||
std::vector<std::string> local_args = args_;
|
||||
uint32_t priority = 0;
|
||||
std::set<uint32_t> subaddr_indices = {};
|
||||
if (!parse_subaddr_indices_and_priority(*m_wallet, local_args, subaddr_indices, priority))
|
||||
if (!parse_subaddr_indices_and_priority(*m_wallet, local_args, subaddr_indices, priority, m_current_subaddress_account))
|
||||
return false;
|
||||
|
||||
if (local_args.size() < 2)
|
||||
|
@ -6408,7 +6413,7 @@ bool simple_wallet::lns_buy_mapping(const std::vector<std::string>& args)
|
|||
std::vector<std::string> local_args = args;
|
||||
uint32_t priority = 0;
|
||||
std::set<uint32_t> subaddr_indices = {};
|
||||
if (!parse_subaddr_indices_and_priority(*m_wallet, local_args, subaddr_indices, priority)) return false;
|
||||
if (!parse_subaddr_indices_and_priority(*m_wallet, local_args, subaddr_indices, priority, m_current_subaddress_account)) return false;
|
||||
|
||||
std::string owner = eat_named_argument(local_args, LNS_OWNER_PREFIX, loki::char_count(LNS_OWNER_PREFIX));
|
||||
std::string backup_owner = eat_named_argument(local_args, LNS_BACKUP_OWNER_PREFIX, loki::char_count(LNS_BACKUP_OWNER_PREFIX));
|
||||
|
@ -6482,7 +6487,7 @@ bool simple_wallet::lns_update_mapping(const std::vector<std::string>& args)
|
|||
std::vector<std::string> local_args = args;
|
||||
uint32_t priority = 0;
|
||||
std::set<uint32_t> subaddr_indices = {};
|
||||
if (!parse_subaddr_indices_and_priority(*m_wallet, local_args, subaddr_indices, priority)) return false;
|
||||
if (!parse_subaddr_indices_and_priority(*m_wallet, local_args, subaddr_indices, priority, m_current_subaddress_account)) return false;
|
||||
|
||||
|
||||
std::string owner = eat_named_argument(local_args, LNS_OWNER_PREFIX, loki::char_count(LNS_OWNER_PREFIX));
|
||||
|
@ -7047,7 +7052,9 @@ bool simple_wallet::sweep_main(uint64_t below, Transfer transfer_type, const std
|
|||
std::vector<std::string> local_args = args_;
|
||||
uint32_t priority = 0;
|
||||
std::set<uint32_t> subaddr_indices = {};
|
||||
if (!parse_subaddr_indices_and_priority(*m_wallet, local_args, subaddr_indices, priority)) return false;
|
||||
|
||||
if (!parse_subaddr_indices_and_priority(*m_wallet, local_args, subaddr_indices, priority, true /*allow_parse_all_argument*/))
|
||||
return false;
|
||||
|
||||
uint64_t unlock_block = 0;
|
||||
if (transfer_type == Transfer::Locked) {
|
||||
|
|
|
@ -3282,6 +3282,7 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height,
|
|||
MERROR("Blocks start before blockchain offset: " << blocks_start_height << " " << m_blockchain.offset());
|
||||
return;
|
||||
}
|
||||
current_index = blocks_start_height;
|
||||
if (hashes.size() + current_index < stop_height) {
|
||||
drop_from_short_history(short_chain_history, 3);
|
||||
std::vector<crypto::hash>::iterator right = hashes.end();
|
||||
|
@ -3291,7 +3292,6 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height,
|
|||
short_chain_history.push_front(*right);
|
||||
}
|
||||
}
|
||||
current_index = blocks_start_height;
|
||||
for(auto& bl_id: hashes)
|
||||
{
|
||||
if(current_index >= m_blockchain.size())
|
||||
|
|
|
@ -1292,13 +1292,24 @@ namespace tools
|
|||
return false;
|
||||
}
|
||||
|
||||
std::set<uint32_t> subaddr_indices;
|
||||
if (req.subaddr_indices_all)
|
||||
{
|
||||
for (uint32_t i = 0; i < m_wallet->get_num_subaddresses(req.account_index); ++i)
|
||||
subaddr_indices.insert(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
subaddr_indices = std::move(req.subaddr_indices);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
uint32_t priority = req.priority;
|
||||
if (req.blink || priority != tx_priority_unimportant)
|
||||
priority = tx_priority_blink;
|
||||
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, dsts[0].is_subaddress, req.outputs, CRYPTONOTE_DEFAULT_TX_MIXIN, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, dsts[0].is_subaddress, req.outputs, CRYPTONOTE_DEFAULT_TX_MIXIN, req.unlock_time, priority, extra, req.account_index, subaddr_indices);
|
||||
|
||||
return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.fee_list, res.multisig_txset, res.unsigned_txset, req.do_not_relay, priority == tx_priority_blink,
|
||||
res.tx_hash_list, req.get_tx_hex, res.tx_blob_list, req.get_tx_metadata, res.tx_metadata_list, er);
|
||||
|
|
|
@ -755,6 +755,7 @@ namespace wallet_rpc
|
|||
std::string address; // Destination public address.
|
||||
uint32_t account_index; // Sweep transactions from this account.
|
||||
std::set<uint32_t> subaddr_indices; // (Optional) Sweep from this set of subaddresses in the account.
|
||||
bool subaddr_indices_all; //
|
||||
uint32_t priority; // Set a priority for the transaction. Accepted values are: 1 for unimportant or 5 for blink. (0 and 2-4 are accepted for backwards compatibility and are equivalent to 5)
|
||||
bool blink; // (Deprecated) Set priority to 5 for blink, field is deprecated: specifies that the tx should be blinked (`priority` will be ignored).
|
||||
uint64_t outputs; //
|
||||
|
@ -770,6 +771,7 @@ namespace wallet_rpc
|
|||
KV_SERIALIZE(address)
|
||||
KV_SERIALIZE(account_index)
|
||||
KV_SERIALIZE(subaddr_indices)
|
||||
KV_SERIALIZE_OPT(subaddr_indices_all, false)
|
||||
KV_SERIALIZE(priority)
|
||||
KV_SERIALIZE_OPT(blink, false)
|
||||
KV_SERIALIZE_OPT(outputs, (uint64_t)1)
|
||||
|
|
Loading…
Reference in New Issue