bitcoin/bitcoin — pull request #5393 by paveljanik (2014-11-29 10:09:16+00:00)
Title: Check for available funds before call to SendMoney.

RPC call sendtoaddress doesn't check for available funds before the call to SendMoney. This results in suboptimal RPC error code returned. RPC_WALLET_ERROR (-4) instead of RPC_WALLET_INSUFFICIENT_FUNDS (-6):

```
# Before:
pavel$ ./bitcoin-cli sendtoaddress m...address... 1000
error: {"code":-4,"message":"Insufficient funds"}
# After:
pavel$ ./bitcoin-cli sendtoaddress m...address... 1000
error: {"code":-6,"message":"Insufficient funds"}
```
This fixes issue #3007.