diff options
| author | Riccardo Spagni <ric@spagni.net> | 2019-01-28 21:35:46 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2019-01-28 21:35:46 +0200 |
| commit | 40bb66cc1eb2b8fbb129e4931af88857875f7a42 (patch) | |
| tree | 7f5cba7f154df0878cf5826370a86d0240aba9e9 /src/cryptonote_core/cryptonote_core.cpp | |
| parent | 23c7663167d9d0000e782d3b3f1423b942347431 (diff) | |
| parent | 23813c7160fa1236cc882cae0ae40f3bee339f91 (diff) | |
| download | monzero-core-40bb66cc1eb2b8fbb129e4931af88857875f7a42.tar.gz monzero-core-40bb66cc1eb2b8fbb129e4931af88857875f7a42.tar.xz monzero-core-40bb66cc1eb2b8fbb129e4931af88857875f7a42.zip | |
Merge pull request #5053
23813c71 blockchain: add --reorg-notify (moneromooo-monero)
f6db59b0 notify: handle arbitrary tags (moneromooo-monero)
ff959216 notify: warn if the spec contains one of '"\ (moneromooo-monero)
13852678 common: set MONERO_DEFAULT_LOG_CATEGORY for notify and spawn (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core/cryptonote_core.cpp')
| -rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 48c607ff1..1513bb750 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -185,6 +185,13 @@ namespace cryptonote , "Prune blockchain" , false }; + static const command_line::arg_descriptor<std::string> arg_reorg_notify = { + "reorg-notify" + , "Run a program for each reorg, '%s' will be replaced by the split height, " + "'%h' will be replaced by the new blockchain height, and '%n' will be " + "replaced by the number of new blocks in the new chain" + , "" + }; //----------------------------------------------------------------------------------------------- core::core(i_cryptonote_protocol* pprotocol): @@ -300,6 +307,7 @@ namespace cryptonote command_line::add_arg(desc, arg_pad_transactions); command_line::add_arg(desc, arg_block_notify); command_line::add_arg(desc, arg_prune_blockchain); + command_line::add_arg(desc, arg_reorg_notify); miner::init_options(desc); BlockchainDB::init_options(desc); @@ -582,6 +590,16 @@ namespace cryptonote MERROR("Failed to parse block notify spec"); } + try + { + if (!command_line::is_arg_defaulted(vm, arg_reorg_notify)) + m_blockchain_storage.set_reorg_notify(std::shared_ptr<tools::Notify>(new tools::Notify(command_line::get_arg(vm, arg_reorg_notify).c_str()))); + } + catch (const std::exception &e) + { + MERROR("Failed to parse reorg notify spec"); + } + const std::pair<uint8_t, uint64_t> regtest_hard_forks[3] = {std::make_pair(1, 0), std::make_pair(Blockchain::get_hard_fork_heights(MAINNET).back().version, 1), std::make_pair(0, 0)}; const cryptonote::test_options regtest_test_options = { regtest_hard_forks |
