Bitcoin Forum
September 27, 2018, 10:55:08 PM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How important is GetMedianTimePast in UpdateTime ?  (Read 428 times)
spencerdupre
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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!