Lack of it results in `m_refresh_from_block_height` being < 0 (18446744...) on low heights, which blocks `process_new_blockchain_entry` and never process coins on heights less than blocks_per_month.
Follow-up to #2258
This might prevent some calls to terminate when the LockedTXN
dtor is called as part of stack unwinding caused by another
exception in the first place.
2289ead5 blockchain_import: warn for chunks over 500000, not 100000 (moneromooo-monero)
2f9a5528 blockchain_import: properly cleanup core/db on exit (moneromooo-monero)
8d6967be blockchain_import: do not error out on truncated files (moneromooo-monero)
a3662bae cryptonote_protocol: error handling on cleanup_handle_incoming_blocks (moneromooo-monero)
cf4aa653 Fix blockchain_import wedge on exception in cleanup_handle_incoming_blocks (moneromooo-monero)
0ffad5a3 core: guard against exceptions in handle_incoming_{block,tx} (moneromooo-monero)
3dd34a49 Cleanup test impact of moving blockchain_db_types() (Howard Chu)
80344740 More DB support cleanup (Howard Chu)
4c7f8ac0 DB cleanup (Howard Chu)
4bd9e247 wallet: new option to check/confirm txpool backlog when sending (moneromooo-monero)
0c61be37 rpc: add a new RPC to get current txpool backlog (sizes and fees) (moneromooo-monero)
2d8a6a6f blockchain: cap memory size of retrieved blocks (moneromooo-monero)
20bedf32 rpc: decrease memory usage a bit in getblocks.bin (moneromooo-monero)
df0cffed cryptonote_protocol: warn if we see a higher top version we expect (moneromooo-monero)
317ab21a cryptonote_protocol: less strict check on top version on connect (moneromooo-monero)
cc81a371 cryptonote_protocol: update target height when syncing too (moneromooo-monero)
e2ad372b cryptonote_protocol: simplify and remove unnecessary casts (moneromooo-monero)
727e67ca cryptonote_protocol: print peer top height along with its version (moneromooo-monero)
b5345ef4 crypto: use malloc instead of alloca (moneromooo-monero)
80794b31 thread_group: set thread size to THREAD_STACK_SIZE (moneromooo-monero)
5524bc31 print peer id in 0 padded hex for consistency (moneromooo-monero)
8f8cc09b contrib: add sync_info to rlwrap command set (moneromooo-monero)
70b8c6d7 cryptonote_protocol: misc fixes to the new sync algorithm (moneromooo-monero)
Fix sync wedge corner case:
It could happen if a connection went into standby mode, while
it was the one which had requested the next span, and that span
was still waiting for the data, and that peer is not on the
main chain. Other peers can then start asking for that data
again and again, but never get it as only that forked peer does.
And various other fixes
If monerod is started with default sync mode, set it to SAFE after
synchronization completes. Set it back to FAST if synchronization
restarts (e.g. because another peer has a longer blockchain).
If monerod is started with an explicit sync mode, none of this
automation takes effect.
Hide DB types from db_types.h - no reason to recompile dependencies
when DB types change.
Also remove lingering in-memory DB references, they've been
obsolete since 9e82b694da
const uint8_t version = m_core.get_ideal_hard_fork_version(hshd.current_height - 1);
if (version >= 6 && version != hshd.top_version)
{
LOG_DEBUG_CC(context, "Ignoring due to wrong top version " << (unsigned)hshd.top_version << ", expected " << (unsigned)version);
if (version < hshd.top_version)
MCLOG_RED(el::Level::Warning, "global", context << " peer claims higher version that we think - we may be forked from the network and a software upgrade may be needed");
LOG_DEBUG_CC(context, "Ignoring due to wrong top version for block " << (hshd.current_height - 1) << ": " << (unsigned)hshd.top_version << ", expected " << (unsigned)version);
return false;
}
@ -286,15 +293,17 @@ namespace cryptonote
/* As I don't know if accessing hshd from core could be a good practice,
I prefer pushing target height to the core at the same time it is pushed to the user.
MCLOG(is_inital ? el::Level::Info : el::Level::Debug, "global", context << "Sync data returned a new top block candidate: " << m_core.get_current_blockchain_height() << " -> " << hshd.current_height
%(!has_mining_info?"mining info unavailable":mining_busy?"syncing":mres.active?((mres.is_background_mining_enabled?"smart ":"")+std::string("mining at ")+get_mining_speed(mres.speed)):"not mining")
tools::msg_writer()<<n_transactions<<" tx(es), "<<res.pool_stats.bytes_total<<" bytes total (min "<<res.pool_stats.bytes_min<<", max "<<res.pool_stats.bytes_max<<", avg "<<avg_bytes<<")"<<std::endl
<<"fees "<<cryptonote::print_money(res.pool_stats.fee_total)<<" (avg "<<cryptonote::print_money(n_transactions?res.pool_stats.fee_total/n_transactions:0)<<" per tx"<<", "<<cryptonote::print_money(res.pool_stats.bytes_total?res.pool_stats.fee_total/res.pool_stats.bytes_total:0)<<" per byte )"<<std::endl
<<res.pool_stats.num_not_relayed<<" not relayed, "<<res.pool_stats.num_failing<<" failing, "<<res.pool_stats.num_10m<<" older than 10 minutes (oldest "<<(res.pool_stats.oldest==0?"-":get_human_time_ago(res.pool_stats.oldest,now))<<")";
<<"fees "<<cryptonote::print_money(res.pool_stats.fee_total)<<" (avg "<<cryptonote::print_money(n_transactions?res.pool_stats.fee_total/n_transactions:0)<<" per tx"<<", "<<cryptonote::print_money(res.pool_stats.bytes_total?res.pool_stats.fee_total/res.pool_stats.bytes_total:0)<<" per byte)"<<std::endl
<<res.pool_stats.num_not_relayed<<" not relayed, "<<res.pool_stats.num_failing<<" failing, "<<res.pool_stats.num_10m<<" older than 10 minutes (oldest "<<(res.pool_stats.oldest==0?"-":get_human_time_ago(res.pool_stats.oldest,now))<<"), "<<backlog_message;
message_writer()<<(boost::format(tr("%u block (%u minutes) backlog at priority %u%s"))%nblocks_low%minutes_low%priority%msg).str();
else
message_writer()<<(boost::format(tr("%u to %u block (%u to %u minutes) backlog at priority %u"))%nblocks_low%nblocks_high%minutes_low%minutes_high%priority).str();
}
else
message_writer()<<tr("No backlog at priority ")<<priority;
m_cmd_binder.set_handler("set",boost::bind(&simple_wallet::set_variable,this,_1),tr("Available options: seed language - set wallet seed language; always-confirm-transfers <1|0> - whether to confirm unsplit txes; print-ring-members <1|0> - whether to print detailed information about ring members during confirmation; store-tx-info <1|0> - whether to store outgoing tx info (destination address, payment ID, tx secret key) for future reference; default-ring-size <n> - set default ring size (default is 5); auto-refresh <1|0> - whether to automatically sync new blocks from the daemon; refresh-type <full|optimize-coinbase|no-coinbase|default> - set wallet refresh behaviour; priority [0|1|2|3|4] - default/unimportant/normal/elevated/priority fee; confirm-missing-payment-id <1|0>; ask-password <1|0>; unit <monero|millinero|micronero|nanonero|piconero> - set default monero (sub-)unit; min-outputs-count [n] - try to keep at least that many outputs of value at least min-outputs-value; min-outputs-value [n] - try to keep at least min-outputs-count outputs of at least that value; merge-destinations <1|0> - whether to merge multiple payments to the same destination address"));
m_cmd_binder.set_handler("set",boost::bind(&simple_wallet::set_variable,this,_1),tr("Available options: seed language - set wallet seed language; always-confirm-transfers <1|0> - whether to confirm unsplit txes; print-ring-members <1|0> - whether to print detailed information about ring members during confirmation; store-tx-info <1|0> - whether to store outgoing tx info (destination address, payment ID, tx secret key) for future reference; default-ring-size <n> - set default ring size (default is 5); auto-refresh <1|0> - whether to automatically sync new blocks from the daemon; refresh-type <full|optimize-coinbase|no-coinbase|default> - set wallet refresh behaviour; priority [0|1|2|3|4] - default/unimportant/normal/elevated/priority fee; confirm-missing-payment-id <1|0>; ask-password <1|0>; unit <monero|millinero|micronero|nanonero|piconero> - set default monero (sub-)unit; min-outputs-count [n] - try to keep at least that many outputs of value at least min-outputs-value; min-outputs-value [n] - try to keep at least min-outputs-count outputs of at least that value; merge-destinations <1|0> - whether to merge multiple payments to the same destination address; confirm-backlog <1|0> - whether to warn if there is transaction backlog; refresh-from-block-height [n] - set height before which to ignore blocks"));
m_cmd_binder.set_handler("rescan_spent",boost::bind(&simple_wallet::rescan_spent,this,_1),tr("Rescan blockchain for spent outputs"));
m_cmd_binder.set_handler("get_tx_key",boost::bind(&simple_wallet::get_tx_key,this,_1),tr("Get transaction key (r) for a given <txid>"));
m_cmd_binder.set_handler("check_tx_key",boost::bind(&simple_wallet::check_tx_key,this,_1),tr("Check amount going to <address> in <txid>"));
@ -707,6 +794,7 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("show_transfer",boost::bind(&simple_wallet::show_transfer,this,_1),tr("Show information about a transfer to/from this address"));
m_cmd_binder.set_handler("payment_id",boost::bind(&simple_wallet::payment_id,this,_1),tr("Generate a new random full size payment id - these will be unencrypted on the blockchain, see integrated_address for encrypted short payment ids"));
m_cmd_binder.set_handler("fee",boost::bind(&simple_wallet::print_fee_info,this,_1),tr("Print information about fee and current transaction backlog"));
m_cmd_binder.set_handler("help",boost::bind(&simple_wallet::help,this,_1),tr("Show this help"));