本文整理汇总了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
}
示例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;
}
示例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);
}
示例4: toHex
static std::string minHex(h256 const& _h)
{
unsigned i = 0;
for (; i < 31 && !_h[i]; ++i) {}
return toHex(_h.ref().cropped(i));
}