support Undo KOMODO_LASTMINED
This commit is contained in:
@@ -338,6 +338,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
|
|||||||
if ( i == 0 && j == 0 && memcmp(NOTARY_PUBKEY33,scriptbuf+1,33) == 0 )
|
if ( i == 0 && j == 0 && memcmp(NOTARY_PUBKEY33,scriptbuf+1,33) == 0 )
|
||||||
{
|
{
|
||||||
printf("%s KOMODO_LASTMINED.%d -> %d\n",ASSETCHAINS_SYMBOL,KOMODO_LASTMINED,height);
|
printf("%s KOMODO_LASTMINED.%d -> %d\n",ASSETCHAINS_SYMBOL,KOMODO_LASTMINED,height);
|
||||||
|
prevKOMODO_LASTMINED = KOMODO_LASTMINED;
|
||||||
KOMODO_LASTMINED = height;
|
KOMODO_LASTMINED = height;
|
||||||
}
|
}
|
||||||
decode_hex(crypto777,33,(char *)CRYPTO777_PUBSECPSTR);
|
decode_hex(crypto777,33,(char *)CRYPTO777_PUBSECPSTR);
|
||||||
|
|||||||
@@ -116,6 +116,12 @@ void komodo_event_rewind(struct komodo_state *sp,char *symbol,int32_t height)
|
|||||||
struct komodo_event *ep;
|
struct komodo_event *ep;
|
||||||
if ( sp != 0 )
|
if ( sp != 0 )
|
||||||
{
|
{
|
||||||
|
if ( ASSETCHAINS_SYMBOL[0] == 0 && height <= KOMODO_LASTMINED && prevKOMODO_LASTMINED != 0 )
|
||||||
|
{
|
||||||
|
printf("undo KOMODO_LASTMINED %d <- %d\n",KOMODO_LASTMINED,prevKOMODO_LASTMINED);
|
||||||
|
KOMODO_LASTMINED = prevKOMODO_LASTMINED;
|
||||||
|
prevKOMODO_LASTMINED = 0;
|
||||||
|
}
|
||||||
while ( sp->Komodo_events != 0 && sp->Komodo_numevents > 0 )
|
while ( sp->Komodo_events != 0 && sp->Komodo_numevents > 0 )
|
||||||
{
|
{
|
||||||
if ( (ep= sp->Komodo_events[sp->Komodo_numevents-1]) != 0 )
|
if ( (ep= sp->Komodo_events[sp->Komodo_numevents-1]) != 0 )
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ struct komodo_state KOMODO_STATES[34];
|
|||||||
int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
|
int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
|
||||||
|
|
||||||
int32_t IS_KOMODO_NOTARY,KOMODO_REWIND,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET;
|
int32_t IS_KOMODO_NOTARY,KOMODO_REWIND,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET;
|
||||||
int32_t KOMODO_LASTMINED;
|
int32_t KOMODO_LASTMINED,prevKOMODO_LASTMINED;
|
||||||
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES;
|
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES;
|
||||||
uint8_t NOTARY_PUBKEY33[33];
|
uint8_t NOTARY_PUBKEY33[33];
|
||||||
|
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese
|
|||||||
|
|
||||||
int32_t komodo_baseid(char *origbase);
|
int32_t komodo_baseid(char *origbase);
|
||||||
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height);
|
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height);
|
||||||
int32_t FOUND_BLOCK;
|
int32_t FOUND_BLOCK,KOMODO_MAYBEMINED;
|
||||||
extern int32_t KOMODO_LASTMINED;
|
extern int32_t KOMODO_LASTMINED;
|
||||||
|
|
||||||
void static BitcoinMiner(CWallet *pwallet)
|
void static BitcoinMiner(CWallet *pwallet)
|
||||||
@@ -667,7 +667,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||||||
if ( mids[j] == notaryid )
|
if ( mids[j] == notaryid )
|
||||||
break;
|
break;
|
||||||
} else fprintf(stderr,"no nonz pubkeys\n");
|
} else fprintf(stderr,"no nonz pubkeys\n");
|
||||||
if ( j == 65 && Mining_height > KOMODO_LASTMINED+64 )
|
if ( j == 65 && Mining_height > KOMODO_MAYBEMINED+3 && Mining_height > KOMODO_LASTMINED+64 )
|
||||||
{
|
{
|
||||||
hashTarget = arith_uint256().SetCompact(KOMODO_MINDIFF_NBITS);
|
hashTarget = arith_uint256().SetCompact(KOMODO_MINDIFF_NBITS);
|
||||||
fprintf(stderr,"I am the chosen one for %s ht.%d\n",ASSETCHAINS_SYMBOL,pindexPrev->nHeight+1);
|
fprintf(stderr,"I am the chosen one for %s ht.%d\n",ASSETCHAINS_SYMBOL,pindexPrev->nHeight+1);
|
||||||
@@ -792,6 +792,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||||||
fprintf(stderr,"%02x",((uint8_t *)&hash)[i]);
|
fprintf(stderr,"%02x",((uint8_t *)&hash)[i]);
|
||||||
fprintf(stderr," <- %s Block found %d\n",ASSETCHAINS_SYMBOL,Mining_height);
|
fprintf(stderr," <- %s Block found %d\n",ASSETCHAINS_SYMBOL,Mining_height);
|
||||||
FOUND_BLOCK = 1;
|
FOUND_BLOCK = 1;
|
||||||
|
KOMODO_MAYBEMINED = Mining_height;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (EhSolverCancelledException&) {
|
} catch (EhSolverCancelledException&) {
|
||||||
|
|||||||
Reference in New Issue
Block a user