当前位置: 首页>>代码示例>>C++>>正文


C++ BlockInfo::number方法代码示例

本文整理汇总了C++中BlockInfo::number方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockInfo::number方法的具体用法?C++ BlockInfo::number怎么用?C++ BlockInfo::number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BlockInfo的用法示例。


在下文中一共展示了BlockInfo::number方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: generateSeal

void EthashSealEngine::generateSeal(BlockInfo const& _bi)
{
	m_sealing = Ethash::BlockHeader(_bi);
	m_farm.setWork(m_sealing);
	m_farm.start(m_sealer);
	m_farm.setWork(m_sealing);		// TODO: take out one before or one after...
	bytes shouldPrecompute = option("precomputeDAG");
	if (!shouldPrecompute.empty() && shouldPrecompute[0] == 1)
		Ethash::ensurePrecomputed((unsigned)_bi.number());
}
开发者ID:AndresAH,项目名称:cpp-ethereum,代码行数:10,代码来源:EthashSealEngine.cpp

示例2: calculateDifficulty

u256 BlockInfo::calculateDifficulty(BlockInfo const& _parent) const
{
	const unsigned c_expDiffPeriod = 100000;

	if (!m_number)
		throw GenesisBlockCannotBeCalculated();
	u256 o = max<u256>(c_minimumDifficulty, m_timestamp >= _parent.m_timestamp + c_durationLimit ? _parent.m_difficulty - (_parent.m_difficulty / c_difficultyBoundDivisor) : (_parent.m_difficulty + (_parent.m_difficulty / c_difficultyBoundDivisor)));
	unsigned periodCount = unsigned(_parent.number() + 1) / c_expDiffPeriod;
	if (periodCount > 1)
		o = max<u256>(c_minimumDifficulty, o + (u256(1) << (periodCount - 2)));	// latter will eventually become huge, so ensure it's a bigint.
	return o;
}
开发者ID:Chooka,项目名称:cpp-ethereum,代码行数:12,代码来源:BlockInfo.cpp

示例3: badBlockInfo

static void badBlockInfo(BlockInfo const& _bi, string const& _err)
{
    string const c_line = EthReset EthOnMaroon + string(80, ' ') + EthReset;
    string const c_border = EthReset EthOnMaroon + string(2, ' ') + EthReset EthMaroonBold;
    string const c_space = c_border + string(76, ' ') + c_border + EthReset;
    stringstream ss;
    ss << c_line << endl;
    ss << c_space << endl;
    ss << c_border + "  Import Failure     " + _err + string(max<int>(0, 53 - _err.size()), ' ') + "  " + c_border << endl;
    ss << c_space << endl;
    string bin = toString(_bi.number());
    ss << c_border + ("                     Guru Meditation #" + string(max<int>(0, 8 - bin.size()), '0') + bin + "." + _bi.hash().abridged() + "                    ") + c_border << endl;
    ss << c_space << endl;
    ss << c_line;
    cwarn << "\n" + ss.str();
}
开发者ID:daukantas,项目名称:cpp-ethereum,代码行数:16,代码来源:Common.cpp

示例4: cacheSize

uint64_t EthashAux::cacheSize(BlockInfo const& _header)
{
	return ethash_get_cachesize((uint64_t)_header.number());
}
开发者ID:AndresAH,项目名称:cpp-ethereum,代码行数:4,代码来源:EthashAux.cpp


注:本文中的BlockInfo::number方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。