Code clean up (#414)

* unused variable

* redundant assignment, maybe it should be result = result | error?

* reduce scope

* never used variable

* reduce scope

* Indent

* Indent
This commit is contained in:
Nick Porter 2018-01-06 15:30:10 -08:00 committed by clemahieu
commit 3ce3ad0de3
5 changed files with 3 additions and 7 deletions

View file

@ -18,9 +18,9 @@ bool rai::from_string_hex (std::string const & value_a, uint64_t & target_a)
{
std::stringstream stream (value_a);
stream << std::hex << std::noshowbase;
uint64_t number_l;
try
{
uint64_t number_l;
stream >> number_l;
target_a = number_l;
if (!stream.eof ())

View file

@ -630,7 +630,6 @@ void format_dec (std::ostringstream & stream, rai::uint128_t value, char group_s
int group_count = 0;
for (int i = 0; i < dec_count; i++)
{
int groupMax = groupings[group_index];
group_count++;
if (group_count > groupings[group_index])
{

View file

@ -2777,8 +2777,9 @@ void rai::active_transactions::announce_votes ()
std::vector<rai::block_hash> inactive;
rai::transaction transaction (node.store.environment, nullptr, true);
std::lock_guard<std::mutex> lock (mutex);
size_t announcements (0);
{
size_t announcements (0);
auto i (roots.begin ());
auto n (roots.end ());
// Announce our decision for up to `announcements_per_interval' conflicts

View file

@ -1260,7 +1260,6 @@ std::shared_ptr<rai::wallet> rai::wallets::create (rai::uint256_union const & id
rai::transaction transaction (node.store.environment, nullptr, true);
result = std::make_shared<rai::wallet> (error, transaction, node, id_a.to_string ());
items[id_a] = result;
result = result;
}
if (!error)
{

View file

@ -664,7 +664,6 @@ void rai::block_store::upgrade_v3_to_v4 (MDB_txn * transaction_a)
void rai::block_store::upgrade_v4_to_v5 (MDB_txn * transaction_a)
{
unsigned fixes (0);
version_put (transaction_a, 5);
for (auto i (latest_begin (transaction_a)), n (latest_end ()); i != n; ++i)
{
@ -678,14 +677,12 @@ void rai::block_store::upgrade_v4_to_v5 (MDB_txn * transaction_a)
if (block_successor (transaction_a, hash).is_zero () && !successor.is_zero ())
{
//std::cerr << boost::str (boost::format ("Adding successor for account %1%, block %2%, successor %3%\n") % account.to_account () % hash.to_string () % successor.to_string ());
++fixes;
block_put (transaction_a, hash, *block, successor);
}
successor = hash;
block = block_get (transaction_a, block->previous ());
}
}
//std::cerr << boost::str (boost::format ("Fixed up %1% blocks\n") % fixes);
}
void rai::block_store::upgrade_v5_to_v6 (MDB_txn * transaction_a)