bitcoin/bitcoin — pull request #3576 by chjj (2014-01-23 04:15:05+00:00)
Title: API calls for getting "sending" labels and addresses

As far as I can tell, right now with the API, there is a way to list (only) our own accounts/labels (listaccounts) and *any* addresses, given we have the account-name/label (getaddressesbyaccount). It seems like we should also be able to easily list accounts/labels belonging to "sending" addresses. An application accessing this API has no way to get at these currently, short of either linking to BDB or writing a makeshift parser for the wallet.dat (neither of which solve the problem of getting this data from a remote server).

This PR adds one API call: `listsendingaddresses`. It returns an object containing all labels+addresses that return false for `IsMine()`. It would be just as effective to return an array containing just the labels, but I thought this mirrored `listaccounts` nicely as an object.

``` bash
$ bitcoind listaccounts
{
"" : 0.00000000,
"primary" : 0.00000000
}
$ bitcoind listsendingaddresses
{
"foobar" : "1Mggntit5x2xbWeSHAJewJ4gzSnSgx4LLe",
"foobar2" : "1QFwNG5y7CN57nBWkctU5oLQkLbA1w2BdR"
}
$ bitcoind getaddressesbyaccount foobar2
[
"1QFwNG5y7CN57nBWkctU5oLQkLbA1w2BdR"
]
```