Fixing wallet.work test.

Putting lock in proper location.
This commit is contained in:
clemahieu 2016-02-06 13:24:49 -06:00
commit 24ae029901
2 changed files with 2 additions and 2 deletions

View file

@ -592,7 +592,7 @@ TEST (wallet, work)
ASSERT_FALSE (system.work.work_validate (root1, work4));
uint64_t work3 (0);
auto iteration (0);
while (work3 != work4)
while (system.work.work_validate (root1, work3))
{
system.poll ();
rai::transaction transaction (system.nodes [0]->store.environment, nullptr, false);

View file

@ -1452,7 +1452,6 @@ void rai::payment_observer::start (uint64_t timeout)
auto this_l (shared_from_this ());
rpc.node.service.add (std::chrono::system_clock::now () + std::chrono::milliseconds (timeout), [this_l] ()
{
std::lock_guard <std::mutex> lock (this_l->rpc.mutex);
this_l->complete (rai::payment_status::nothing);
});
}
@ -1496,6 +1495,7 @@ void rai::payment_observer::complete (rai::payment_status status)
break;
}
}
std::lock_guard <std::mutex> lock (rpc.mutex);
assert (rpc.payment_observers.find (account) != rpc.payment_observers.end ());
rpc.payment_observers.erase (account);
}