本文整理汇总了C++中cryptonote::WalletGreen::createFusionTransaction方法的典型用法代码示例。如果您正苦于以下问题:C++ WalletGreen::createFusionTransaction方法的具体用法?C++ WalletGreen::createFusionTransaction怎么用?C++ WalletGreen::createFusionTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cryptonote::WalletGreen
的用法示例。
在下文中一共展示了WalletGreen::createFusionTransaction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeFusionTransaction
size_t makeFusionTransaction(CryptoNote::WalletGreen &wallet,
uint64_t threshold)
{
uint64_t bestThreshold = threshold;
size_t optimizable = 0;
/* Find the best threshold by starting at threshold and decreasing by
half till we get to the minimum amount, storing the threshold that
gave us the most amount of optimizable amounts */
while (threshold > WalletConfig::minimumSend)
{
const auto fusionReadyCount
= wallet.estimate(threshold).fusionReadyCount;
if (fusionReadyCount > optimizable)
{
optimizable = fusionReadyCount;
bestThreshold = threshold;
}
threshold /= 2;
}
/* Can't optimize */
if (optimizable == 0)
{
return CryptoNote::WALLET_INVALID_TRANSACTION_ID;
}
try
{
return wallet.createFusionTransaction(bestThreshold,
WalletConfig::defaultMixin);
}
catch (const std::runtime_error &e)
{
std::cout << WarningMsg("Failed to send fusion transaction: ")
<< WarningMsg(e.what()) << std::endl;
return CryptoNote::WALLET_INVALID_TRANSACTION_ID;
}
}