Bitcoin Forum
November 09, 2024, 12:21:31 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Is the maturation time for new coins documented anywhere else?  (Read 1803 times)
fivebells (OP)
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


View Profile
December 01, 2011, 07:29:39 PM
 #1

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?)
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5376
Merit: 13407


View Profile
December 01, 2011, 08:19:14 PM
 #2

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.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
fivebells (OP)
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


View Profile
December 02, 2011, 06:30:34 PM
 #3

Thanks, Theymos.

I've only ever generated litecoins (came too late for solo generation of bitcoins.)
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!