subtly/cpp-ethereum — pull request #2 by giact (2014-08-17 12:05:13+00:00)
Title: Deadlock when sending a new transaction; missing coinbase when mining the first block

When sending a new transaction, the client is very likely to deadlock.

How to reproduce:

* Execute a new transaction, e.g. `(suicide (caller))`

Reason:

BlockChain::run() calls BlockChain::sync() right before checking if its worker thread is running.
The lambda thread locks x_sync in while loop and never unlocks it.
BlockChain::sync() tries to lock x_sync as well.
If BlockChain::run() gets called while its lambda is already running on another thread, its initial call to BlockChain::sync() will be stuck.

***

When the client starts mining before Client::sync() ever got called (e.g. when the client has never seen any new block and there are no pending transactions), the coinbase is null because Client::setAddress() was setting the coinbase only for m_premine

How to reproduce:

* Disable network, kill blockchain, mine one block, check its coinbase and/or your balance