Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: FairUser on June 11, 2011, 04:21:27 AM



Title: Block confirmed after only 104 blocks later, not 120.
Post by: FairUser on June 11, 2011, 04:21:27 AM
Start here:  http://blockexplorer.com/b/129803
Follow the address it was paid to:  1LdrTWcXu5qYvEggB6PodEs2proXrQMNLs
I'm going to copy and paste this, so sorry if the formatting is off.

Transaction?   Block?   
5a91af17b3...   Block 129803 (2011-06-10 11:12:25)
21a9a054a0...   Block 129907 (2011-06-10 23:32:50)   

How did a block get confirmed after just 104 blocks?  Shouldn't this be 120 blocks like the blocks before and after it?

Now to make this even more strange/frustrating, our pool (bitcoinpool) had a block ( 129806 ) go orphaned *after* we paid out on it 120 blocks later.  Our code explicitly checks to make sure the block is valid AND confirmed before we pay out, and it was paid out BEFORE it went orphaned. Then about 2 blocks after it was confirmed, it changed to Orphaned.

Here's a dump from our 'listgenerated' from bitcoind.
[
    {
        "account" : "",
        "category" : "generate",
        "amount" : 50.04000000,
        "confirmations" : 239,
        "block_hash" : "00000000000012fbcf784971681c91eac50040480aa1525f8548d1ac6d4a06bd",
        "block_index" : 0,
        "txid" : "a445379234a83536814f8196388b295792696b79dcf8920aafd3664edf220df8",
        "time" : 1307676121
    },
    {
        "account" : "",
        "category" : "orphan",
        "amount" : 50.11351319,
        "confirmations" : 0, <-- Should be 140
        "txid" : "7db5b5e710fcad4957cc1d498bf008bea27b8ded618a9f74eab9f91c9799f505",
        "time" : 1307705806
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 50.12306040,
        "confirmations" : 72,
        "block_hash" : "0000000000000d5d50045d8e321b7d97f988f497b80fb1fa4ca98e9725bcdab3",
        "block_index" : 0,
        "txid" : "a53a442e87a53cd06e6298b055da89b7b59716ccfa23aba29c47ff22365bc84e",
        "time" : 1307733695
    },
    {
        "account" : "",
        "category" : "immature",
        "amount" : 50.26881957,
        "confirmations" : 36,
        "block_hash" : "0000000000000d74bcd54e04d45e2750af8e3700e2b6f9daa42f1a6498d331db",
        "block_index" : 0,
        "txid" : "f9ffe4f638a3c08523357351088bc8d5d260000c76305db4c4ccefa6fb09add8",
        "time" : 1307750373
    }
]

The TX ID:  7db5b5e710fcad4957cc1d498bf008bea27b8ded618a9f74eab9f91c9799f505  doesn't exist in block explorer.

So here's the questions I'd appreciate an answer to are:

1) How does a block get "confirmed" after only 104 blocks?
2) How does a block go "orphaned" after it's been "confirmed" (meaning, it reached 120 blocks then went "orphaned" shortly after that)?
3) Are these signs that something strange is happening in the block chain, and if so, could it be someone else doing this on purpose?


Thank you in advance for any good explanation.



Title: Re: Block confirmed after only 104 blocks later, not 120.
Post by: theymos on June 11, 2011, 05:06:37 AM
The network only enforces a maturation time of 100 blocks. The extra 20 blocks is a client limit only.

Quote
How does a block go "orphaned" after it's been "confirmed" (meaning, it reached 120 blocks then went "orphaned" shortly after that)?

A bug, probably. Or maybe you were segmented for a really long time.


Title: Re: Block confirmed after only 104 blocks later, not 120.
Post by: FairUser on June 11, 2011, 05:27:09 AM
The network only enforces a maturation time of 100 blocks. The extra 20 blocks is a client limit only.

Quote
How does a block go "orphaned" after it's been "confirmed" (meaning, it reached 120 blocks then went "orphaned" shortly after that)?

100 blocks to mature eh? Everywhere I've read says it's 120.  Has it always been that way?  Do you have a reference I could refer to for more reading up on this?

A bug, probably. Or maybe you were segmented for a really long time.

We weren't segmented. Things have been really stable since we update the hardware infrastructure.

Thank you for the answers and your time.


Title: Re: Block confirmed after only 104 blocks later, not 120.
Post by: theymos on June 11, 2011, 05:38:49 AM
100 blocks to mature eh? Everywhere I've read says it's 120.  Has it always been that way?  Do you have a reference I could refer to for more reading up on this?

It has always been that way. Everywhere says 120 because that's what the client says. The actual network limit is 100, though. Check the code:
Code:
static const int COINBASE_MATURITY = 100;

Use the -printblock switch to dump all blocks (including orphans) to debug.log, and then post the last few thousand blocks to pastebin or something so I can examine your block.


Title: Re: Block confirmed after only 104 blocks later, not 120.
Post by: gmaxwell on June 11, 2011, 11:30:18 PM
100 blocks to mature eh? Everywhere I've read says it's 120.  Has it always been that way?  Do you have a reference I could refer to for more reading up on this?

It has always been that way. Everywhere says 120 because that's what the client says. The actual network limit is 100, though. Check the code:
Code:
static const int COINBASE_MATURITY = 100;

Use the -printblock switch to dump all blocks (including orphans) to debug.log, and then post the last few thousand blocks to pastebin or something so I can examine your block.

I'm using a limit of 103 on namcoin.   I was using just 100 for a while but had some weird behavior with getting a rejection notice when I did sends of coin right at 100 (thought it got sent and mined ::shrugs::)  I assume this was due to neighboring nodes not having the latest block yet then rejecting my txn. 20 is kinda nuts (especially on bitcoin) but I think having a buffer of a few is good.

I haven't bothered making the same change for bitcoin because I'm not using new generations quickly there.