Post
Topic
Board Hardware
Re: Is there interest in a standalone low power miner?
by
rapsacw
on 23/06/2023, 12:00:09 UTC
..
Alas that code doesn't consider the actual restrictions in bitcoin.
He has no idea about it.
I am not going to risc it and limit ntime rolling to a safe 60s, this should work
Quote
/*
 * Create block header for new job by incrementing ntime and/or xnonce2,
 * calls Header_construct to create a new binary block header.
 */
void Header_nextjob()
{
  // m_ntimeBCKUP contains the ntime value received from pool
  // m_Tntime contains the time (in ms) when work was received from pool
  if(ROLLNTIME && (m_RollednTime<(MAX_NTIME_ROLL+(millis()-m_Tntime))/1000))
  {
    inc_4bin(m_ntime); // increment nTime
    m_RollednTime++;
    Header_construct(0); // contruct new block header, don't calculate new merkle
  }
  else
  {
    inc_nbin(m_xnonce2,m_xnonce2sz);
    memcpy(m_ntime,m_ntimeBCKUP,4); // restore ntime to unrolled value
    m_RollednTime = 0;
    Header_construct(1); // construct new block header, calculate new merkle
  }
}
where MAX_NTIME_ROLL = 60

Thanks.