Author

Topic: RPC "GetBalance" when does it increment? (Read 1100 times)

kjj
legendary
Activity: 1302
Merit: 1025
August 05, 2012, 11:28:11 AM
#6
If you really need to override this behavior, you should be able to use the raw transaction API.

Also, the client won't include generated coins in the balance or new transactions until 120 blocks have passed.  I just mention it for completeness.
legendary
Activity: 4326
Merit: 3041
Vile Vixen and Miss Bitcointalk 2021-2023
August 02, 2012, 04:18:38 PM
#5
So that leads me to my followup question.  It isn't possible to "spend" 0-confirm tx with bitcoind?  The protocol allows it.
0-confirm transactions can only be spent if they came from yourself (change or send-to-self), since bitcoind doesn't "trust" transactions from other sources until they have at least 1 confirmation. This rule came about after one version of Bitcoin had a bug that caused it to sometimes send transactions with insufficient fees, which would therefore never be confirmed. Normally this would be no big deal, except that other clients simply accepted these transactions and spent them, creating even more transactions which would never confirm, which would be spent again, and so on ad infinitum, until finally everyone's transactions were getting stuck because everyone's wallets were filled with coins that were never going to confirm. It was a real mess.

So now Bitcoin will only trust other people's transactions if they have at least one confirmation, which is the way it should be. The old way of just trusting all transactions, confirmed or not, never really made sense, since the whole point of distinguishing between confirmed and unconfirmed transactions in the first place is that unconfirmed transactions can't be trusted (eg, they may yet be double-spent, while confirmed transactions cannot (at least, not without a lot of further discussion)).
legendary
Activity: 1596
Merit: 1091
August 01, 2012, 11:13:20 AM
#4
There are many ways that the bitcoin software is more conservative than the protocol Smiley

Only relaying standard transactions is another well-known example...

donator
Activity: 1218
Merit: 1079
Gerald Davis
August 01, 2012, 10:51:09 AM
#3
Ah.  No wonder why I couldn't figure it out.  I first assumed it was 0 but then I noticed a delay so I figured it was 1 but that wasn't always consistent.  I didn't think of the possibility that "from self" would be handled differently.

So that leads me to my followup question.  It isn't possible to "spend" 0-confirm tx with bitcoind?  The protocol allows it.
If bitcoind doesn't increment until 1 confirmation it will error out (insufficient funds) until 1-confirm is detected and it it increments.

Thus bitcoind is more conservative than the protocol?  I guess this behavior can't be overriden without modifying the source.
legendary
Activity: 1596
Merit: 1091
August 01, 2012, 10:36:54 AM
#2
When does "GetBalance" increment?
When the bitcoind receives a 0-confirm tx, after 1 confirmation, after 6?
Can this be modified short of modifying the source code and recompiling?

Had to ask sipa for the answer:  1 for external transactions, 0 for change or send-to-self ones

sr. member
Activity: 476
Merit: 250
Tangible Cryptography LLC
August 01, 2012, 10:09:11 AM
#1
When does "GetBalance" increment?
When the bitcoind receives a 0-confirm tx, after 1 confirmation, after 6?
Can this be modified short of modifying the source code and recompiling?
Jump to: