Skip to content

Commit

Permalink
wallet2.cpp indentation fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mbg033 committed Jan 12, 2018
1 parent a4f5b12 commit 963a2b5
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions src/wallet/wallet2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2251,37 +2251,37 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const std::stri
return retval;
}

uint64_t wallet2::estimate_blockchain_height()
{
// -1 month for fluctuations in block time and machine date/time setup.
// avg seconds per block
const int seconds_per_block = DIFFICULTY_TARGET_V2;
// ~num blocks per month
const uint64_t blocks_per_month = 60*60*24*30/seconds_per_block;

// try asking the daemon first
std::string err;
uint64_t height = 0;

// we get the max of approximated height and known height
// approximated height is the least of daemon target height
// (the max of what the other daemons are claiming is their
// height) and the theoretical height based on the local
// clock. This will be wrong only if both the local clock
// is bad *and* a peer daemon claims a highest height than
// the real chain.
// known height is the height the local daemon is currently
// synced to, it will be lower than the real chain height if
// the daemon is currently syncing.
height = get_approximate_blockchain_height();
uint64_t target_height = get_daemon_blockchain_target_height(err);
if (err.empty() && target_height < height)
height = target_height;
uint64_t local_height = get_daemon_blockchain_height(err);
if (err.empty() && local_height > height)
height = local_height;
return height;
}
uint64_t wallet2::estimate_blockchain_height()
{
// -1 month for fluctuations in block time and machine date/time setup.
// avg seconds per block
const int seconds_per_block = DIFFICULTY_TARGET_V2;
// ~num blocks per month
const uint64_t blocks_per_month = 60*60*24*30/seconds_per_block;

// try asking the daemon first
std::string err;
uint64_t height = 0;

// we get the max of approximated height and known height
// approximated height is the least of daemon target height
// (the max of what the other daemons are claiming is their
// height) and the theoretical height based on the local
// clock. This will be wrong only if both the local clock
// is bad *and* a peer daemon claims a highest height than
// the real chain.
// known height is the height the local daemon is currently
// synced to, it will be lower than the real chain height if
// the daemon is currently syncing.
height = get_approximate_blockchain_height();
uint64_t target_height = get_daemon_blockchain_target_height(err);
if (err.empty() && target_height < height)
height = target_height;
uint64_t local_height = get_daemon_blockchain_height(err);
if (err.empty() && local_height > height)
height = local_height;
return height;
}

/*!
* \brief Creates a watch only wallet from a public address and a view secret key.
Expand Down

0 comments on commit 963a2b5

Please sign in to comment.