@@ -520,7 +520,8 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese
520
520
}
521
521
522
522
int32_t komodo_baseid (char *origbase);
523
- int32_t komodo_eligiblenotary (int32_t *mids,int32_t *nonzpkeysp,int32_t height);
523
+ int32_t komodo_eligiblenotary (uint8_t pubkeys[66 ][33 ],int32_t *mids,int32_t *nonzpkeysp,int32_t height);
524
+ int32_t FOUND_BLOCK;
524
525
525
526
void static BitcoinMiner (CWallet *pwallet)
526
527
{
@@ -615,21 +616,34 @@ void static BitcoinMiner(CWallet *pwallet)
615
616
//
616
617
// Search
617
618
//
618
- int mids[66 ],nonzpkeys,j; uint32_t savebits; int64_t nStart = GetTime ();
619
+ uint8_t pubkeys[ 66 ][ 33 ]; int mids[66 ],nonzpkeys,i ,j; uint32_t savebits; int64_t nStart = GetTime ();
619
620
savebits = pblock->nBits ;
620
621
arith_uint256 hashTarget = arith_uint256 ().SetCompact (pblock->nBits );
621
622
if ( ASSETCHAINS_SYMBOL[0 ] == 0 && notaryid >= 0 )// komodo_is_special(pindexPrev->nHeight+1,NOTARY_PUBKEY33) > 0 )
622
623
{
623
624
if ( (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 )
624
625
{
625
- komodo_eligiblenotary (mids,&nonzpkeys,pindexPrev->nHeight );
626
+ komodo_eligiblenotary (pubkeys, mids,&nonzpkeys,pindexPrev->nHeight );
626
627
if ( nonzpkeys > 0 )
627
628
{
628
- if ( notaryid < 2 )
629
+ if ( NOTARY_PUBKEY33[ 0 ] != 0 && notaryid < 1 )
629
630
{
630
- for (j=0 ; j<65 ; j++)
631
- fprintf (stderr," %d " ,mids[j]);
632
- fprintf (stderr," <- prev minerids from ht.%d notary.%d\n " ,pindexPrev->nHeight ,notaryid);
631
+ for (i=1 ; i<66 ; i++)
632
+ if ( memcmp (pubkeys[i],pubkeys[0 ],33 ) == 0 )
633
+ break ;
634
+ if ( i != 66 )
635
+ {
636
+ printf (" VIOLATION at %d\n " ,i);
637
+ for (i=0 ; i<66 ; i++)
638
+ {
639
+ for (j=0 ; j<33 ; j++)
640
+ printf (" %02x" ,pubkeys[i][j]);
641
+ printf (" p%d -> %d\n " ,i,komodo_minerid (pindexPrev->nHeight -i,pubkeys[i]));
642
+ }
643
+ for (j=0 ; j<65 ; j++)
644
+ fprintf (stderr," %d " ,mids[j]);
645
+ fprintf (stderr," <- prev minerids from ht.%d notary.%d VIOLATION\n " ,pindexPrev->nHeight ,notaryid);
646
+ }
633
647
}
634
648
for (j=0 ; j<65 ; j++)
635
649
if ( mids[j] == notaryid )
@@ -706,6 +720,8 @@ void static BitcoinMiner(CWallet *pwallet)
706
720
ehSolverRuns.increment ();
707
721
throw boost::thread_interrupted ();
708
722
}
723
+ // if ( ASSETCHAINS_SYMBOL[0] == 0 && NOTARY_PUBKEY33[0] != 0 )
724
+ // sleep(1800);
709
725
return true ;
710
726
};
711
727
std::function<bool (EhSolverCancelCheck)> cancelled = [&m_cs, &cancelSolver](EhSolverCancelCheck pos) {
@@ -756,7 +772,7 @@ void static BitcoinMiner(CWallet *pwallet)
756
772
for (i=0 ; i<32 ; i++)
757
773
fprintf (stderr," %02x" ,((uint8_t *)&hash)[i]);
758
774
fprintf (stderr," <- %s Block found %d\n " ,ASSETCHAINS_SYMBOL,Mining_height);
759
- sleep ( 60 ); // avoid mining forks
775
+ FOUND_BLOCK = 1 ;
760
776
break ;
761
777
}
762
778
} catch (EhSolverCancelledException&) {
@@ -769,6 +785,12 @@ void static BitcoinMiner(CWallet *pwallet)
769
785
// Check for stop or if block needs to be rebuilt
770
786
boost::this_thread::interruption_point ();
771
787
// Regtest mode doesn't require peers
788
+ if ( FOUND_BLOCK != 0 )
789
+ {
790
+ FOUND_BLOCK = 0 ;
791
+ fprintf (stderr," FOUND_BLOCK!\n " );
792
+ sleep (2000 );
793
+ }
772
794
if (vNodes.empty () && chainparams.MiningRequiresPeers ())
773
795
{
774
796
if ( ASSETCHAINS_SYMBOL[0 ] == 0 || Mining_height > ASSETCHAINS_MINHEIGHT )
0 commit comments