Well either I'm doing something wrong or there's something wrong with my bitcoind.
$ bitcoind getaddressesbyaccount bitcoiner
[
"17A1QM8Tjjd8cyHPYmzC3M4ou9Q8RXWjKv",
"14iRpAsjszmbUY1HrU9yarPJm1sbtKM6Ew",
"19ZZ8DZsb5qgchuKPZWET7Uj8rDoj4KgmB"
]
$ bitcoind listaddressgroupings | grep 17A1QM8Tjjd8cyHPYmzC3M4ou9Q8RXWjKv
(nothing here...)
$ bitcoind listaddressgroupings | grep 14iRpAsjszmbUY1HrU9yarPJm1sbtKM6Ew #just to check...
"14iRpAsjszmbUY1HrU9yarPJm1sbtKM6Ew",
So the first thing is that
listaddressgroupings doesn't list all addresses in the wallet.
The second thing is that for every address returned by
listaddressgroupings (except for these returned by
getaddressesbyaccount)
getaccount gives nothing. Here's an output of a little script implementing Stephen's idea (checking for bitcoiner account):
$ php test.php
array(2) {
[0]=>
string(34) "14iRpAsjszmbUY1HrU9yarPJm1sbtKM6Ew"
[1]=>
string(34) "19ZZ8DZsb5qgchuKPZWET7Uj8rDoj4KgmB"
}
Code fragment using jsonRPCClient.php:
$addresses = $this->conn->listaddressgroupings();
$addresses = $addresses[0];
$ret = array();
foreach($addresses as $address) {
if($this->conn->getaccount($address[0]) == $account)
$ret[] = $address[0];
}
var_dump($ret);