Author

Topic: Is the maturation time for new coins documented anywhere else? (Read 1805 times)

sr. member
Activity: 462
Merit: 250
Thanks, Theymos.

I've only ever generated litecoins (came too late for solo generation of bitcoins.)
administrator
Activity: 5222
Merit: 13032
It's checked in ConnectInputs:
Code:
            // If prev is coinbase, check that it's matured
            if (txPrev.IsCoinBase())
                for (CBlockIndex* pindex = pindexBlock; pindex && pindexBlock->nHeight - pindex->nHeight < COINBASE_MATURITY; pindex = pindex->pprev)
                    if (pindex->nBlockPos == txindex.pos.nBlockPos && pindex->nFile == txindex.pos.nFile)
                        return error("ConnectInputs() : tried to spend coinbase at depth %d", pindexBlock->nHeight - pindex->nHeight);

You'll be familiar with maturation if you've ever generated solo (or on Eligius): the client lists those coinbase transactions as "Generated (matures in x more blocks)".

The UI also offers this help text about maturation:
Quote
Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to "not accepted" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.
sr. member
Activity: 462
Merit: 250
Just came across this rule:
Quote
The 50 BTC reward for [an] orphan block will be lost, which is why a network-enforced 100-block maturation time for generations exists.
  Makes sense.  First time I'd seen this rule, and I was just wondering whether there are any systematic descriptions of the protocol which mention this.  I didn't come across it in the wiki's description of the protocol specification or rules, and I'm wondering what else I might read to get as comprehensive an understanding as possible.  (Other than the code, of course.  I know I have to be reading that, too.  Incidentally, where is the code in the Satoshi client and pybtcengine which implements this rule?)
Jump to: