diff options
author | Jason Wong <jason.hcwong@gmail.com> | 2018-11-25 22:08:07 +0100 |
---|---|---|
committer | Jason Wong <jason.hcwong@gmail.com> | 2018-11-28 12:20:28 +0100 |
commit | dc1c12528d5cf86759993614e1fdd7d7bf04ff15 (patch) | |
tree | 8fa2119970bd01b384481d2944b1dc137f271435 /src/rpc/core_rpc_server.cpp | |
parent | Merge pull request #4821 (diff) | |
download | monero-dc1c12528d5cf86759993614e1fdd7d7bf04ff15.tar.xz |
add command pop_blocks
add new public method to Blockchain and update according to code review
update after review: better lock/unlock, try catch and coding style
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index f029d1d5a..2fb70c995 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -2021,6 +2021,18 @@ namespace cryptonote return true; } //------------------------------------------------------------------------------------------------------------------------------ + bool core_rpc_server::on_pop_blocks(const COMMAND_RPC_POP_BLOCKS::request& req, COMMAND_RPC_POP_BLOCKS::response& res) + { + PERF_TIMER(on_pop_blocks); + + m_core.get_blockchain_storage().pop_blocks(req.nblocks); + + res.height = m_core.get_current_blockchain_height(); + res.status = CORE_RPC_STATUS_OK; + + return true; + } + //------------------------------------------------------------------------------------------------------------------------------ bool core_rpc_server::on_relay_tx(const COMMAND_RPC_RELAY_TX::request& req, COMMAND_RPC_RELAY_TX::response& res, epee::json_rpc::error& error_resp) { PERF_TIMER(on_relay_tx); |