Skip to content

Instantly share code, notes, and snippets.

void BlockChain::insert(bytes const& _block, bytesConstRef _receipts, bool _mustBeNew)
{
// VERIFY: populates from the block and checks the block is internally coherent.
VerifiedBlockRef block;
#if ETH_CATCH
try
#endif
{
block = verifyBlock(&_block, m_onBad, ImportRequirements::OutOfOrderChecks);
VerifiedBlockRef BlockChain::verifyBlock(bytesConstRef _block, std::function<void(Exception&)> const& _onBad, ImportRequirements::value _ir) const
{
VerifiedBlockRef res;
BlockHeader h;
try
{
h = BlockHeader(_block);
if (!!(_ir & ImportRequirements::PostGenesis) && (!h.parentHash() || h.number() == 0))
BOOST_THROW_EXCEPTION(InvalidParentHash() << errinfo_required_h256(h.parentHash()) << errinfo_currentNumber(h.number()));
/** @file BlockChain.h
* @author Gav Wood <i@gavwood.com>
* @date 2014
*/
#pragma once
#include "Account.h"
#include "BlockDetails.h"