tgerring (OP)
Full Member
Offline
Activity: 142
Merit: 100
Hive/Ethereum
|
|
August 29, 2013, 05:03:56 AM |
|
I've been swapping wallet.dat back and forth all night to simulate transactions between wallets and I'm receiving what appears to be incorrect information from `getbalance accountname` (which lists more than the wallet contains). Any idea what's going on or how to correct it? Cycling bitcoin-qt (with server=1) doesn't help. This is on testnet$ bitcoind getbalance 1.00060000
$ bitcoind getbalance THISISTHEACCOUNTNAME 2.43000000
$ bitcoind getinfo && bitcoind listunspent{ "version" : 80300, "protocolversion" : 70001, "walletversion" : 60000, "balance" : 1.00060000, "blocks" : 103288, "timeoffset" : 0, "connections" : 2, "proxy" : "", "difficulty" : 1.00000000, "testnet" : true, "keypoololdest" : 1377735562, "keypoolsize" : 101, "paytxfee" : 0.00000000, "unlocked_until" : 0, "errors" : "" } [ { "txid" : "9547db820d37c81603d1f7bee78c4b007d3a8ba39c4f8b9b98f250562ffbefca", "vout" : 1, "address" : "mr2udJKNUS9UrzxngqFuF6xvVJSskuGAwo", "scriptPubKey" : "76a914735b82684e35a836223a19ceea94091fb32dd9c688ac", "amount" : 0.00060000, "confirmations" : 11 }, { "txid" : "b2c77af6708d0247912a1b934b713a03d459d9a04fc86d6b5035fc5244cc448a", "vout" : 1, "address" : "mzKWkrjFy8CYCMg6Qjwm5DakdwhWWrmFbR", "account" : "THISISTHEACCOUNTNAME", "scriptPubKey" : "76a914ce407f12d457a6a743f6c210606ff55a207c735688ac", "amount" : 0.40000000, "confirmations" : 1 }, { "txid" : "b37b9cc5a3e86526697a171b31b59e91a05081e641f8e1ec319fefb7625c925c", "vout" : 0, "address" : "mzKWkrjFy8CYCMg6Qjwm5DakdwhWWrmFbR", "account" : "THISISTHEACCOUNTNAME", "scriptPubKey" : "76a914ce407f12d457a6a743f6c210606ff55a207c735688ac", "amount" : 0.60000000, "confirmations" : 2 } ]
$ bitcoind getaddressesbyaccount THISISTHEACCOUNTNAME [ "mzKWkrjFy8CYCMg6Qjwm5DakdwhWWrmFbR" ]
|
|
|
|
tgerring (OP)
Full Member
Offline
Activity: 142
Merit: 100
Hive/Ethereum
|
|
August 29, 2013, 02:08:00 PM |
|
Shutting down bitcoin-qt overnight and letting it catch up in the morning didn't seem to have any effect. Still not sure what to do
|
|
|
|
kjj
Legendary
Offline
Activity: 1302
Merit: 1026
|
|
August 29, 2013, 07:16:13 PM |
|
Accounts can be negative.
|
17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8 I routinely ignore posters with paid advertising in their sigs. You should too.
|
|
|
tgerring (OP)
Full Member
Offline
Activity: 142
Merit: 100
Hive/Ethereum
|
|
August 29, 2013, 08:06:20 PM |
|
Accounts can be negative.
Perhaps I'm misunderstanding the use of accounts. Could you expand on that? Or happy to read any reference documentation.
|
|
|
|
grue
Legendary
Offline
Activity: 2058
Merit: 1446
|
|
August 29, 2013, 08:56:18 PM |
|
|
|
|
|
tgerring (OP)
Full Member
Offline
Activity: 142
Merit: 100
Hive/Ethereum
|
|
August 30, 2013, 03:23:58 AM |
|
The sendfrom method sends coins and debits the specified account. The wiki mentions "debits", so I understand the possibility for an account to go negative. But if new transactions to an address associated with an account act as the only credit mechanism, under what circumstances would an account show a balance more than the wallet total?
|
|
|
|
theymos
Administrator
Legendary
Offline
Activity: 5376
Merit: 13368
|
|
August 30, 2013, 03:31:33 AM |
|
The wiki mentions "debits", so I understand the possibility for an account to go negative. But if new transactions to an address associated with an account act as the only credit mechanism, under what circumstances would an account show a balance more than the wallet total?
getbalance 20 getbalance ac 20 move '' ac 20000 getbalance ac 20020 getbalance 20 sendtoaddress 1A... 20 getbalance 0 getbalance ac 20020
|
1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
|
|
|
tgerring (OP)
Full Member
Offline
Activity: 142
Merit: 100
Hive/Ethereum
|
|
September 05, 2013, 03:49:13 PM |
|
I'm still not sure what's going on, since I never used the `move` command, but it's apparent that the account balance is not working as expected. Since I'm mapping a single account to a single address, my workaround is to rely on `listunspent` and build a dictionary of balances. Python example: def getaccountbalances(): totals = {}
unspentinputs = self.access.listunspent() for tx in unspentinputs: if 'account' in tx and tx['amount'] > 0: if not tx['account'] in totals: totals[tx['account']] = 0 totals[tx['account']] += round(tx['amount'], 8)
return totals
|
|
|
|
kjj
Legendary
Offline
Activity: 1302
Merit: 1026
|
|
September 05, 2013, 05:07:36 PM |
|
I'm still not sure what's going on, since I never used the `move` command, but it's apparent that the account balance is not working as expected.
This is a frequent complaint. Search the boards for many more examples of threads substantially identical to yours. Accounts do not work the way you think they do. They are not intended for the use you are attempting.
|
17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8 I routinely ignore posters with paid advertising in their sigs. You should too.
|
|
|
tgerring (OP)
Full Member
Offline
Activity: 142
Merit: 100
Hive/Ethereum
|
|
September 05, 2013, 05:35:20 PM |
|
They are not intended for the use you are attempting.
Someone's got to do something at some point since this appears to be a problem not willing to go away. The code I posted was a drop-in replacement for how I expected `getbalance` to work in conjunction with `sendfrom`. Hopefully it helps someone else too.
|
|
|
|
nagagaga
Newbie
Offline
Activity: 13
Merit: 0
|
|
June 10, 2018, 12:16:13 PM |
|
I've been swapping wallet.dat back and forth all night to simulate transactions between wallets and I'm receiving what appears to be incorrect information from `getbalance accountname` (which lists more than the wallet contains). Any idea what's going on or how to correct it? Cycling bitcoin-qt (with server=1) doesn't help. This is on testnet$ bitcoind getbalance 1.00060000
$ bitcoind getbalance THISISTHEACCOUNTNAME 2.43000000
$ bitcoind getinfo && bitcoind listunspent{ "version" : 80300, "protocolversion" : 70001, "walletversion" : 60000, "balance" : 1.00060000, "blocks" : 103288, "timeoffset" : 0, "connections" : 2, "proxy" : "", "difficulty" : 1.00000000, "testnet" : true, "keypoololdest" : 1377735562, "keypoolsize" : 101, "paytxfee" : 0.00000000, "unlocked_until" : 0, "errors" : "" } [ { "txid" : "9547db820d37c81603d1f7bee78c4b007d3a8ba39c4f8b9b98f250562ffbefca", "vout" : 1, "address" : "mr2udJKNUS9UrzxngqFuF6xvVJSskuGAwo", "scriptPubKey" : "76a914735b82684e35a836223a19ceea94091fb32dd9c688ac", "amount" : 0.00060000, "confirmations" : 11 }, { "txid" : "b2c77af6708d0247912a1b934b713a03d459d9a04fc86d6b5035fc5244cc448a", "vout" : 1, "address" : "mzKWkrjFy8CYCMg6Qjwm5DakdwhWWrmFbR", "account" : "THISISTHEACCOUNTNAME", "scriptPubKey" : "76a914ce407f12d457a6a743f6c210606ff55a207c735688ac", "amount" : 0.40000000, "confirmations" : 1 }, { "txid" : "b37b9cc5a3e86526697a171b31b59e91a05081e641f8e1ec319fefb7625c925c", "vout" : 0, "address" : "mzKWkrjFy8CYCMg6Qjwm5DakdwhWWrmFbR", "account" : "THISISTHEACCOUNTNAME", "scriptPubKey" : "76a914ce407f12d457a6a743f6c210606ff55a207c735688ac", "amount" : 0.60000000, "confirmations" : 2 } ]
$ bitcoind getaddressesbyaccount THISISTHEACCOUNTNAME [ "mzKWkrjFy8CYCMg6Qjwm5DakdwhWWrmFbR" ]
Hey Im getting this error too! Do you have any idea how to solve this issue?
|
|
|
|
|