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
This commit is contained in:
Jason Wong
2018-11-25 22:08:07 +01:00
parent 58ce16d4d9
commit dc1c12528d
10 changed files with 138 additions and 0 deletions

View File

@@ -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);