Bitcoin Forum
May 24, 2024, 05:03:53 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How important is GetMedianTimePast in UpdateTime ?  (Read 467 times)
spencerdupre (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
August 19, 2015, 05:15:29 AM
 #1

Trying to learn more about the code, and producing some altcoins with modifications to test.  I've got one with Devcoin merged mining patches applied, trying to merge mine it with Bitcoin.  During merged mining, but not single coin mining, it produces rejected blocks which have timestamps either years in the past, or decades in the future (usually the latter).  I tracked it down to UpdateTime, and GetMedianTimePast.  UpdateTime returns the max of GetMedianTimePast, and GetAdjustedTime.  Sometimes, GetMedianTimePast returns wildly high positive numbers, though usually it produces wildly low negative numbers.  If they're positive, they're the max(), and become the new timestamp.  So I've cut GetMedianTimePast out of UpdateTime:

Code:
//    block.nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
    block.nTime = GetAdjustedTime();

Are there any major consequences to doing this?

Alternatively, if you have any ideas why GetMedianTimePast is producing numbers like -6969792509024063232 and 441414620544770536, that would also be super helpful.
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!