I reinstalled bitcoin on a new computer, and took my old wallet.dat file from an old pc that had v.0.3 of the bitcoin software.
I had 2 receiving addresses when I started.
When I typed getaddressesbyaccount ""
it listed the 2 addresses.
I then did the command getnewaddress
then noticed that my wallet.backup file had assigned new reserved addresses.
I did a test spend between my 2 old addresses. I sent 0.0001 for the 1st address to 2nd address, expecting change to come back to the first, but it seems that the unspent got sent to the 3rd.
It looks like account name is set by the label. Everything seems to still belong to the wallet but I have 2 accounts, 1 with 2 addresses.
Here is the transaction: https://blockchain.info/address/1FsmCgxrrKFPgLxrMgTWUAintbtLeeDf2S
It appears that when I use Bitcoin-qt it thinks that the main account is 18ffH16dzkg64nh8rj8JtSL7K6QYzBBwV2 even though 1FsmCgxrrKFPgLxrMgTWUAintbtLeeDf2S was originally the 1st receiving address.
There doesn't appear to be an obvious intuitive way to determine which account recieves the unspent part of the transaction back.
Not that is should matter as I own them all, but I am trying to understand how this works.