本文整理汇总了C++中cryptonote::WalletGreen::getBlockCount方法的典型用法代码示例。如果您正苦于以下问题:C++ WalletGreen::getBlockCount方法的具体用法?C++ WalletGreen::getBlockCount怎么用?C++ WalletGreen::getBlockCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cryptonote::WalletGreen
的用法示例。
在下文中一共展示了WalletGreen::getBlockCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: status
/* This makes sure to call functions on the node which only return cached
data. This ensures it returns promptly, and doesn't hang waiting for a
response when the node is having issues. */
void status(CryptoNote::INode &node, CryptoNote::WalletGreen &wallet)
{
uint32_t localHeight = node.getLastLocalBlockHeight();
uint32_t remoteHeight = node.getLastKnownBlockHeight();
uint32_t walletHeight = wallet.getBlockCount() - 1;
/* Print the heights of local, remote, and wallet */
printHeights(localHeight, remoteHeight, walletHeight);
std::cout << std::endl;
/* Print the network and wallet sync status in percentage */
printSyncStatus(localHeight, remoteHeight, walletHeight);
std::cout << std::endl;
/* Print the network hashrate, based on the last local block */
printHashrate(node.getLastLocalBlockHeaderInfo().difficulty);
/* Print the amount of peers we have */
printPeerCount(node.getPeerCount());
std::cout << std::endl;
/* Print a summary of the sync status */
printSyncSummary(localHeight, remoteHeight, walletHeight);
}
示例2: 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;
}
}
示例3: blockchainHeight
void blockchainHeight(CryptoNote::INode &node, CryptoNote::WalletGreen &wallet)
{
const uint32_t localHeight = node.getLastLocalBlockHeight();
const uint32_t remoteHeight = node.getLastKnownBlockHeight();
const uint32_t walletHeight = wallet.getBlockCount() - 1;
/* This is the height that the wallet has been scanned to. The blockchain
can be fully updated, but we have to walk the chain to find our
transactions, and this number indicates that progress. */
std::cout << "Wallet blockchain height: ";
/* Small buffer because wallet height doesn't update instantly like node
height does */
if (walletHeight + 1000 > remoteHeight)
{
std::cout << SuccessMsg(std::to_string(walletHeight));
}
else
{
std::cout << WarningMsg(std::to_string(walletHeight));
}
std::cout << std::endl << "Local blockchain height: ";
if (localHeight == remoteHeight)
{
std::cout << SuccessMsg(std::to_string(localHeight));
}
else
{
std::cout << WarningMsg(std::to_string(localHeight));
}
std::cout << std::endl << "Network blockchain height: "
<< SuccessMsg(std::to_string(remoteHeight)) << std::endl;
if (localHeight == 0 && remoteHeight == 0)
{
std::cout << WarningMsg("Uh oh, it looks like you don't have ")
<< WarningMsg(WalletConfig::daemonName)
<< WarningMsg(" open!")
<< std::endl;
}
else if (walletHeight + 1000 < remoteHeight && localHeight == remoteHeight)
{
std::cout << InformationMsg("You are synced with the network, but the "
"blockchain is still being scanned for "
"your transactions.")
<< std::endl
<< "Balances might be incorrect whilst this is ongoing."
<< std::endl;
}
else if (localHeight == remoteHeight)
{
std::cout << SuccessMsg("Yay! You are synced!") << std::endl;
}
else
{
std::cout << WarningMsg("Be patient, you are still syncing with the "
"network!") << std::endl;
}
}