Fix for orphan fix (check blocksize)
This commit is contained in:
parent
feac5a7b2d
commit
75fc3e90b1
|
@ -432,6 +432,18 @@ namespace cryptonote
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
// Used by the RPC server to check the size of an incoming
|
||||||
|
// block_blob
|
||||||
|
bool core::check_incoming_block_size(const blobdata& block_blob)
|
||||||
|
{
|
||||||
|
if(block_blob.size() > get_max_block_size())
|
||||||
|
{
|
||||||
|
LOG_PRINT_L0("WRONG BLOCK BLOB, too big size " << block_blob.size() << ", rejected");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
crypto::hash core::get_tail_id()
|
crypto::hash core::get_tail_id()
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_tail_id();
|
return m_blockchain_storage.get_tail_id();
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace cryptonote
|
||||||
bool on_idle();
|
bool on_idle();
|
||||||
bool handle_incoming_tx(const blobdata& tx_blob, tx_verification_context& tvc, bool keeped_by_block);
|
bool handle_incoming_tx(const blobdata& tx_blob, tx_verification_context& tvc, bool keeped_by_block);
|
||||||
bool handle_incoming_block(const blobdata& block_blob, block_verification_context& bvc, bool update_miner_blocktemplate = true);
|
bool handle_incoming_block(const blobdata& block_blob, block_verification_context& bvc, bool update_miner_blocktemplate = true);
|
||||||
|
bool check_incoming_block_size(const blobdata& block_blob);
|
||||||
i_cryptonote_protocol* get_protocol(){return m_pprotocol;}
|
i_cryptonote_protocol* get_protocol(){return m_pprotocol;}
|
||||||
|
|
||||||
//-------------------- i_miner_handler -----------------------
|
//-------------------- i_miner_handler -----------------------
|
||||||
|
|
|
@ -449,6 +449,15 @@ namespace cryptonote
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix from Boolberry neglects to check block
|
||||||
|
// size, do that with the function below
|
||||||
|
if(!m_core.check_incoming_block_size(blockblob))
|
||||||
|
{
|
||||||
|
error_resp.code = CORE_RPC_ERROR_CODE_WRONG_BLOCKBLOB_SIZE;
|
||||||
|
error_resp.message = "Block bloc size is too big, rejecting block";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(!m_core.handle_block_found(b))
|
if(!m_core.handle_block_found(b))
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_BLOCK_NOT_ACCEPTED;
|
error_resp.code = CORE_RPC_ERROR_CODE_BLOCK_NOT_ACCEPTED;
|
||||||
|
|
Loading…
Reference in New Issue