本文整理汇总了C++中cryptonote::WalletGreen::getPendingBalance方法的典型用法代码示例。如果您正苦于以下问题:C++ WalletGreen::getPendingBalance方法的具体用法?C++ WalletGreen::getPendingBalance怎么用?C++ WalletGreen::getPendingBalance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cryptonote::WalletGreen
的用法示例。
在下文中一共展示了WalletGreen::getPendingBalance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: balance
void balance(CryptoNote::INode &node, CryptoNote::WalletGreen &wallet,
bool viewWallet)
{
const uint64_t unconfirmedBalance = wallet.getPendingBalance();
const uint64_t confirmedBalance = wallet.getActualBalance();
const uint64_t totalBalance = unconfirmedBalance + confirmedBalance;
const uint32_t localHeight = node.getLastLocalBlockHeight();
const uint32_t remoteHeight = node.getLastKnownBlockHeight();
const uint32_t walletHeight = wallet.getBlockCount();
std::cout << "Available balance: "
<< SuccessMsg(formatAmount(confirmedBalance)) << std::endl
<< "Locked (unconfirmed) balance: "
<< WarningMsg(formatAmount(unconfirmedBalance))
<< std::endl << "Total balance: "
<< InformationMsg(formatAmount(totalBalance)) << std::endl;
if (viewWallet)
{
std::cout << std::endl
<< InformationMsg("Please note that view only wallets "
"can only track incoming transactions,")
<< std::endl
<< InformationMsg("and so your wallet balance may appear "
"inflated.") << std::endl;
}
if (localHeight < remoteHeight)
{
std::cout << std::endl
<< InformationMsg("Your daemon is not fully synced with "
"the network!")
<< std::endl
<< "Your balance may be incorrect until you are fully "
<< "synced!" << std::endl;
}
/* Small buffer because wallet height doesn't update instantly like node
height does */
else if (walletHeight + 1000 < remoteHeight)
{
std::cout << std::endl
<< InformationMsg("The blockchain is still being scanned for "
"your transactions.")
<< std::endl
<< "Balances might be incorrect whilst this is ongoing."
<< std::endl;
}
}
示例2: sendMultipleTransactions
void sendMultipleTransactions(CryptoNote::WalletGreen &wallet,
std::vector<CryptoNote::TransactionParameters>
transfers)
{
size_t numTxs = transfers.size();
size_t currentTx = 1;
std::cout << "Your transaction has been split up into " << numTxs
<< " separate transactions of "
<< formatAmount(transfers[0].destinations[0].amount)
<< ". It may take some time to send all the transactions, "
<< "please be patient." << std::endl << std::endl;
for (auto tx : transfers)
{
while (true)
{
std::cout << "Attempting to send transaction "
<< InformationMsg(std::to_string(currentTx))
<< " of " << InformationMsg(std::to_string(numTxs))
<< std::endl;
wallet.updateInternalCache();
uint64_t neededBalance = tx.destinations[0].amount + tx.fee;
if (neededBalance < wallet.getActualBalance())
{
size_t id = wallet.transfer(tx);
CryptoNote::WalletTransaction sentTx
= wallet.getTransaction(id);
std::cout << SuccessMsg("Transaction has been sent!")
<< std::endl
<< SuccessMsg("Hash: "
+ Common::podToHex(sentTx.hash))
<< std::endl << std::endl;
break;
}
std::cout << "Not enough balance available to send transaction, "
<< "this is because some of your balance is used when "
<< "sending another transaction to help hide the size "
<< "of your transaction, and is locked for a short "
<< "time. It will return shortly." << std::endl
<< "Needed balance: " << formatAmount(neededBalance)
<< std::endl << "Available balance: "
<< formatAmount(wallet.getActualBalance())
<< std::endl << "Locked balance: "
<< formatAmount(wallet.getPendingBalance())
<< std::endl << "Will try again in 5 seconds..."
<< std::endl << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(5));
}
currentTx++;
}
std::cout << SuccessMsg("All transactions sent!") << std::endl;
}