}
else
{
- komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata);
- //printf("VALID %s MoM.%s [%d]\n",ASSETCHAINS_SYMBOL,sp->MoM.ToString().c_str(),sp->MoMdepth);
++ //komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata);
+ //printf("[%s] matched.%d VALID (%s) MoM.%s [%d]\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth);
}
+ if ( MoMoMdata.pairs != 0 )
+ free(MoMoMdata.pairs);
+ memset(&ccdata,0,sizeof(ccdata));
+ memset(&MoMoMdata,0,sizeof(MoMoMdata));
}
- else if ( ASSETCHAINS_SYMBOL[0] == 0 && matched != 0 && notarized != 0 && validated != 0 )
- komodo_rwccdata((char *)"KMD",1,&ccdata,0);
- komodo_stateupdate(height,0,0,0,zero,0,0,0,0,0,0,0,0,0,0,sp->MoM,sp->MoMdepth);
- len += nameoffset;
- if ( ASSETCHAINS_SYMBOL[0] != 0 )
- printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth);
- if ( ASSETCHAINS_SYMBOL[0] == 0 )
++ //else if ( ASSETCHAINS_SYMBOL[0] == 0 && matched != 0 && notarized != 0 && validated != 0 )
++ // komodo_rwccdata((char *)"KMD",1,&ccdata,0);
+ if ( matched != 0 && *notarizedheightp > sp->NOTARIZED_HEIGHT && *notarizedheightp < height )
{
- if ( signedfp == 0 )
- {
- char fname[512];
- komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks");
- if ( (signedfp= fopen(fname,"rb+")) == 0 )
- signedfp = fopen(fname,"wb");
- else fseek(signedfp,0,SEEK_END);
- }
- if ( signedfp != 0 )
- {
- fwrite(&height,1,sizeof(height),signedfp);
- fwrite(&signedmask,1,sizeof(signedmask),signedfp);
- fflush(signedfp);
- }
- if ( opretlen > len && scriptbuf[len] == 'A' )
+ sp->NOTARIZED_HEIGHT = *notarizedheightp;
+ sp->NOTARIZED_HASH = srchash;
+ sp->NOTARIZED_DESTTXID = desttxid;
+ sp->MoM = MoM;
+ sp->MoMdepth = MoMdepth;
+ komodo_stateupdate(height,0,0,0,zero,0,0,0,0,0,0,0,0,0,0,sp->MoM,sp->MoMdepth);
+ if ( ASSETCHAINS_SYMBOL[0] != 0 )
+ printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth);
+ if ( ASSETCHAINS_SYMBOL[0] == 0 )
{
- //for (i=0; i<opretlen-len; i++)
- // printf("%02x",scriptbuf[len+i]);
- //printf(" Found extradata.[%d] %d - %d\n",opretlen-len,opretlen,len);
- komodo_stateupdate(height,0,0,0,txhash,0,0,0,0,0,0,value,&scriptbuf[len],opretlen-len+4+3+(scriptbuf[1] == 0x4d),j,zero,0);
+ if ( signedfp == 0 )
+ {
+ char fname[512];
+ komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks");
+ if ( (signedfp= fopen(fname,"rb+")) == 0 )
+ signedfp = fopen(fname,"wb");
+ else fseek(signedfp,0,SEEK_END);
+ }
+ if ( signedfp != 0 )
+ {
+ fwrite(&height,1,sizeof(height),signedfp);
+ fwrite(&signedmask,1,sizeof(signedmask),signedfp);
+ fflush(signedfp);
+ }
+ if ( opretlen > len && scriptbuf[len] == 'A' )
+ {
+ //for (i=0; i<opretlen-len; i++)
+ // printf("%02x",scriptbuf[len+i]);
+ //printf(" Found extradata.[%d] %d - %d\n",opretlen-len,opretlen,len);
+ komodo_stateupdate(height,0,0,0,txhash,0,0,0,0,0,0,value,&scriptbuf[len],opretlen-len+4+3+(scriptbuf[1] == 0x4d),j,zero,0);
+ }
}
}
- } else if ( *notarizedheightp != sp->NOTARIZED_HEIGHT )
- printf("validated.%d notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s (%s) len.%d opretlen.%d\n",validated,notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),desttxid.ToString().c_str(),(char *)&scriptbuf[len],len,opretlen);
+ } else if ( opretlen != 149 && height > 600000 && matched != 0 )
+ printf("%s validated.%d notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s len.%d opretlen.%d\n",ccdata.symbol,validated,notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),desttxid.ToString().c_str(),len,opretlen);
}
- else if ( i == 0 && j == 1 && opretlen == 149 )
+ else if ( matched != 0 && i == 0 && j == 1 && opretlen == 149 )
{
if ( notaryid >= 0 && notaryid < 64 )
komodo_paxpricefeed(height,&scriptbuf[len],opretlen);
return(0);
}
}
-
+
return pblocktemplate.release();
}
-
+
/*
- #ifdef ENABLE_WALLET
- boost::optional<CScript> GetMinerScriptPubKey(CReserveKey& reservekey)
- #else
- boost::optional<CScript> GetMinerScriptPubKey()
- #endif
- {
- CKeyID keyID;
- CBitcoinAddress addr;
- if (addr.SetString(GetArg("-mineraddress", ""))) {
- addr.GetKeyID(keyID);
- } else {
- #ifdef ENABLE_WALLET
- CPubKey pubkey;
- if (!reservekey.GetReservedKey(pubkey)) {
- return boost::optional<CScript>();
- }
- keyID = pubkey.GetID();
- #else
- return boost::optional<CScript>();
- #endif
- }
-
- CScript scriptPubKey = CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG;
- return scriptPubKey;
- }
-
- #ifdef ENABLE_WALLET
- CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
- {
- boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey(reservekey);
- #else
- CBlockTemplate* CreateNewBlockWithKey()
- {
- boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey();
- #endif
-
- if (!scriptPubKey) {
- return NULL;
- }
- return CreateNewBlock(*scriptPubKey);
- }*/
+ #ifdef ENABLE_WALLET
+ boost::optional<CScript> GetMinerScriptPubKey(CReserveKey& reservekey)
+ #else
+ boost::optional<CScript> GetMinerScriptPubKey()
+ #endif
+ {
+ CKeyID keyID;
+ CBitcoinAddress addr;
+ if (addr.SetString(GetArg("-mineraddress", ""))) {
+ addr.GetKeyID(keyID);
+ } else {
+ #ifdef ENABLE_WALLET
+ CPubKey pubkey;
+ if (!reservekey.GetReservedKey(pubkey)) {
+ return boost::optional<CScript>();
+ }
+ keyID = pubkey.GetID();
+ #else
+ return boost::optional<CScript>();
+ #endif
+ }
+
+ CScript scriptPubKey = CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG;
+ return scriptPubKey;
+ }
+
+ #ifdef ENABLE_WALLET
+ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
+ {
+ boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey(reservekey);
+ #else
+ CBlockTemplate* CreateNewBlockWithKey()
+ {
+ boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey();
+ #endif
+
+ if (!scriptPubKey) {
+ return NULL;
+ }
+ return CreateNewBlock(*scriptPubKey);
+ }*/
//////////////////////////////////////////////////////////////////////////////
//