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


C++ h256::ref方法代码示例

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


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

示例1: verify

bool dev::verify(Public const& _p, Signature const& _s, h256 const& _hash)
{
	if (!_p)
		return false;
#ifdef ETH_HAVE_SECP256K1
	return _p == recover(_s, _hash);
#else
	return s_secp256k1pp.verify(_p, _s, _hash.ref(), true);
#endif
}
开发者ID:AndresAH,项目名称:cpp-ethereum,代码行数:10,代码来源:Common.cpp

示例2: recover

Public dev::recover(Signature const& _sig, h256 const& _message)
{
	Public ret;
#ifdef ETH_HAVE_SECP256K1
	bytes o(65);
	int pubkeylen;
	if (!secp256k1_ecdsa_recover_compact(s_secp256k1, _message.data(), _sig.data(), o.data(), &pubkeylen, false, _sig[64]))
		return Public();
	ret = FixedHash<64>(o.data() + 1, Public::ConstructFromPointer);
#else
	ret = s_secp256k1pp.recover(_sig, _message.ref());
#endif
	if (ret == c_zeroKey)
		return Public();
	return ret;
}
开发者ID:AndresAH,项目名称:cpp-ethereum,代码行数:16,代码来源:Common.cpp

示例3: openDB

OverlayDB State::openDB(std::string const& _basePath, h256 const& _genesisHash, WithExisting _we)
{
	std::string path = _basePath.empty() ? Defaults::get()->m_dbPath : _basePath;

	if (_we == WithExisting::Kill)
	{
		cnote << "Killing state database (WithExisting::Kill).";
		boost::filesystem::remove_all(path + "/state");
	}

	path += "/" + toHex(_genesisHash.ref().cropped(0, 4)) + "/" + toString(c_databaseVersion);
	boost::filesystem::create_directories(path);
	DEV_IGNORE_EXCEPTIONS(fs::permissions(path, fs::owner_all));

	ldb::Options o;
	o.max_open_files = 256;
	o.create_if_missing = true;
	ldb::DB* db = nullptr;
	ldb::Status status = ldb::DB::Open(o, path + "/state", &db);
	if (!status.ok() || !db)
	{
		if (boost::filesystem::space(path + "/state").available < 1024)
		{
			cwarn << "Not enough available space found on hard drive. Please free some up and then re-run. Bailing.";
			BOOST_THROW_EXCEPTION(NotEnoughAvailableSpace());
		}
		else
		{
			cwarn << status.ToString();
			cwarn <<
				"Database " <<
				(path + "/state") <<
				"already open. You appear to have another instance of ethereum running. Bailing.";
			BOOST_THROW_EXCEPTION(DatabaseAlreadyOpen());
		}
	}

	cnote << "Opened state DB.";
	return OverlayDB(db);
}
开发者ID:AndresAH,项目名称:cpp-ethereum,代码行数:40,代码来源:State.cpp

示例4: toHex

static std::string minHex(h256 const& _h)
{
	unsigned i = 0;
	for (; i < 31 && !_h[i]; ++i) {}
	return toHex(_h.ref().cropped(i));
}
开发者ID:leecharles,项目名称:libethereum,代码行数:6,代码来源:State.cpp


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