本文整理汇总了C++中CBigNum::bitSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CBigNum::bitSize方法的具体用法?C++ CBigNum::bitSize怎么用?C++ CBigNum::bitSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBigNum
的用法示例。
在下文中一共展示了CBigNum::bitSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acc
bool
Test_MintAndSpend()
{
try {
// This test assumes a list of coins were generated in Test_MintCoin()
if (gCoins[0] == NULL)
{
// No coins: mint some.
Test_MintCoin();
if (gCoins[0] == NULL) {
return false;
}
}
// Accumulate the list of generated coins into a fresh accumulator.
// The first one gets marked as accumulated for a witness, the
// others just get accumulated normally.
Accumulator acc(&g_Params->accumulatorParams,CoinDenomination::ZQ_ONE);
AccumulatorWitness wAcc(g_Params, acc, gCoins[0]->getPublicCoin());
for (uint32_t i = 0; i < TESTS_COINS_TO_ACCUMULATE; i++) {
acc += gCoins[i]->getPublicCoin();
wAcc +=gCoins[i]->getPublicCoin();
}
// Now spend the coin
//SpendMetaData m(1,1);
CDataStream cc(SER_NETWORK, PROTOCOL_VERSION);
cc << *gCoins[0];
PrivateCoin myCoin(g_Params,cc);
CoinSpend spend(g_Params, g_Params, myCoin, acc, 0, wAcc, 0, SpendType::SPEND);
spend.Verify(acc);
// Serialize the proof and deserialize into newSpend
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << spend;
gProofSize = ss.size();
CoinSpend newSpend(g_Params, g_Params, ss);
// See if we can verify the deserialized proof (return our result)
bool ret = newSpend.Verify(acc);
// Extract the serial number
CBigNum serialNumber = newSpend.getCoinSerialNumber();
gSerialNumberSize = ceil((double)serialNumber.bitSize() / 8.0);
return ret;
} catch (runtime_error &e) {
cout << e.what() << endl;
return false;
}
return false;
}