Merge branch 'momom_printsonly' into master

This commit is contained in:
blackjok3rtt
2018-10-31 12:05:38 +08:00
committed by GitHub
5 changed files with 40 additions and 31 deletions

View File

@@ -79,7 +79,11 @@ bool Eval::ImportCoin(const std::vector<uint8_t> params, const CTransaction &imp
if (!GetProofRoot(proof.first, momom)) if (!GetProofRoot(proof.first, momom))
return Invalid("coudnt-load-momom"); return Invalid("coudnt-load-momom");
printf("IMPORT momom: %s\n", momom.GetHex().data()); fprintf(stderr,"IMPORT momom: %s\n", momom.GetHex().data());
FILE * fptr;
fptr = fopen("/home/cc/kmdmomom", "a+");
fprintf(fptr, "%s\n", momom.GetHex().data());
fclose(fptr);
target = proof.second.Exec(burnTx.GetHash()); target = proof.second.Exec(burnTx.GetHash());
if (momom != proof.second.Exec(burnTx.GetHash())) if (momom != proof.second.Exec(burnTx.GetHash()))

View File

@@ -162,7 +162,11 @@ TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_
if (MoMoM.IsNull()) if (MoMoM.IsNull())
throw std::runtime_error("No MoMs found"); throw std::runtime_error("No MoMs found");
printf("GetCrossChainProof MoMoM: %s\n", MoMoM.GetHex().data()); printf("[%s] GetCrossChainProof MoMoM: %s\n", targetSymbol,MoMoM.GetHex().data());
FILE * fptr;
fptr = fopen("/home/cc/acmomom", "a+");
fprintf(fptr, "%s\n", MoMoM.GetHex().data());
fclose(fptr);
// Find index of source MoM in MoMoM // Find index of source MoM in MoMoM
int nIndex; int nIndex;

View File

@@ -620,8 +620,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
notarized = 1; notarized = 1;
if ( strcmp("PIZZA",ccdata.symbol) == 0 || strncmp("TXSCL",ccdata.symbol,5) == 0 ) if ( strcmp("PIZZA",ccdata.symbol) == 0 || strncmp("TXSCL",ccdata.symbol,5) == 0 )
notarized = 1; notarized = 1;
if ( 0 && opretlen != 149 ) //if ( 0 && opretlen != 149 )
printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",ASSETCHAINS_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset); // printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",ASSETCHAINS_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset);
len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&srchash); len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&srchash);
len += iguana_rwnum(0,&scriptbuf[len],sizeof(*notarizedheightp),(uint8_t *)notarizedheightp); len += iguana_rwnum(0,&scriptbuf[len],sizeof(*notarizedheightp),(uint8_t *)notarizedheightp);
if ( matched != 0 ) if ( matched != 0 )
@@ -685,8 +685,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
else else
{ {
komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata); komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata);
if ( matched != 0 ) //if ( matched != 0 )
printf("[%s] matched.%d VALID (%s) MoM.%s [%d] CCid.%u\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff); // printf("[%s] matched.%d VALID (%s) MoM.%s [%d] CCid.%u\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff);
} }
if ( MoMoMdata.pairs != 0 ) if ( MoMoMdata.pairs != 0 )
free(MoMoMdata.pairs); free(MoMoMdata.pairs);
@@ -706,8 +706,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
sp->MoMdepth = MoMdepth; sp->MoMdepth = MoMdepth;
} }
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,0,0,0,0,0,0,sp->MoM,sp->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 ) //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); // 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 ) if ( ASSETCHAINS_SYMBOL[0] == 0 )
{ {
if ( signedfp == 0 ) if ( signedfp == 0 )
@@ -733,8 +733,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
} }
} }
} }
} else if ( opretlen != 149 && height > 600000 && matched != 0 ) } //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); //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 ( matched != 0 && i == 0 && j == 1 && opretlen == 149 ) else if ( matched != 0 && i == 0 && j == 1 && opretlen == 149 )
{ {
@@ -832,7 +832,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
for (i=0; i<txn_count; i++) for (i=0; i<txn_count; i++)
{ {
if ((is_STAKED(ASSETCHAINS_SYMBOL) != 0) && (STAKED_era(pindex->GetBlockTime()) == 0)) { if ((is_STAKED(ASSETCHAINS_SYMBOL) != 0) && (STAKED_era(pindex->GetBlockTime()) == 0)) {
printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); //printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL);
continue; continue;
} }
txhash = block.vtx[i].GetHash(); txhash = block.vtx[i].GetHash();
@@ -856,7 +856,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
printf("%02x",scriptPubKey[k]); printf("%02x",scriptPubKey[k]);
printf(" scriptPubKey doesnt match any notary vini.%d of %d\n",j,numvins); printf(" scriptPubKey doesnt match any notary vini.%d of %d\n",j,numvins);
} }
} else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); } //else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j);
} }
numvalid = bitweight(signedmask); numvalid = bitweight(signedmask);
if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) ||
@@ -880,7 +880,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
fwrite(&signedmask,1,sizeof(signedmask),signedfp); fwrite(&signedmask,1,sizeof(signedmask),signedfp);
fflush(signedfp); fflush(signedfp);
} }
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); //printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
} }
notarized = 1; notarized = 1;
} }
@@ -917,20 +917,20 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
{ {
for (k=0; k<len; k++) for (k=0; k<len; k++)
printf("%02x",scriptbuf[k]); printf("%02x",scriptbuf[k]);
printf(" <- notaryid.%d ht.%d i.%d j.%d numvouts.%d numvins.%d voutmask.%llx txid.(%s)\n",notaryid,height,i,j,numvouts,numvins,(long long)voutmask,txhash.ToString().c_str()); //printf(" <- notaryid.%d ht.%d i.%d j.%d numvouts.%d numvins.%d voutmask.%llx txid.(%s)\n",notaryid,height,i,j,numvouts,numvins,(long long)voutmask,txhash.ToString().c_str());
} }
} }
} }
if ( IS_KOMODO_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 ) if ( IS_KOMODO_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf(") "); printf(") ");
if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 ) if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification); //printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification);
if ( notarized != 0 && (notarizedheight != 0 || specialtx != 0) ) if ( notarized != 0 && (notarizedheight != 0 || specialtx != 0) )
{ {
if ( isratification != 0 ) if ( isratification != 0 )
{ {
printf("%s NOTARY SIGNED.%llx numvins.%d ht.%d txi.%d notaryht.%d specialtx.%d\n",ASSETCHAINS_SYMBOL,(long long)signedmask,numvins,height,i,notarizedheight,specialtx); //printf("%s NOTARY SIGNED.%llx numvins.%d ht.%d txi.%d notaryht.%d specialtx.%d\n",ASSETCHAINS_SYMBOL,(long long)signedmask,numvins,height,i,notarizedheight,specialtx);
printf("ht.%d specialtx.%d isratification.%d numvouts.%d signed.%llx numnotaries.%d\n",height,specialtx,isratification,numvouts,(long long)signedmask,numnotaries); //printf("ht.%d specialtx.%d isratification.%d numvouts.%d signed.%llx numnotaries.%d\n",height,specialtx,isratification,numvouts,(long long)signedmask,numnotaries);
} }
if ( specialtx != 0 && isratification != 0 && numvouts > 2 ) if ( specialtx != 0 && isratification != 0 && numvouts > 2 )
{ {
@@ -959,8 +959,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
{ {
memset(&txhash,0,sizeof(txhash)); memset(&txhash,0,sizeof(txhash));
komodo_stateupdate(height,pubkeys,numvalid,0,txhash,0,0,0,0,0,0,0,0,0,0,zero,0); komodo_stateupdate(height,pubkeys,numvalid,0,txhash,0,0,0,0,0,0,0,0,0,0,zero,0);
printf("RATIFIED! >>>>>>>>>> new notaries.%d newheight.%d from height.%d\n",numvalid,(((height+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,height); //printf("RATIFIED! >>>>>>>>>> new notaries.%d newheight.%d from height.%d\n",numvalid,(((height+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,height);
} else printf("signedmask.%llx numvalid.%d wt.%d numnotaries.%d\n",(long long)signedmask,numvalid,bitweight(signedmask),numnotaries); } //else printf("signedmask.%llx numvalid.%d wt.%d numnotaries.%d\n",(long long)signedmask,numvalid,bitweight(signedmask),numnotaries);
} }
} }
} }

View File

@@ -1336,6 +1336,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS); bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS);
else bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS); else bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS);
if ( dispflag != 0 && ASSETCHAINS_STAKED < 100 ) if ( dispflag != 0 && ASSETCHAINS_STAKED < 100 )
if ( ASSETCHAINS_STAKED < 100 )
{ {
for (i=31; i>=24; i--) for (i=31; i>=24; i--)
fprintf(stderr,"%02x",((uint8_t *)&ave)[i]); fprintf(stderr,"%02x",((uint8_t *)&ave)[i]);
@@ -1442,7 +1443,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_
{ {
if ( isPoS != 2 ) if ( isPoS != 2 )
{ {
fprintf(stderr,"ht.%d isPoS.%d utxo not validated -> must be PoW fake\n",height,isPoS); //fprintf(stderr,"ht.%d isPoS.%d utxo not validated -> must be PoW fake\n",height,isPoS);
isPoS = 0; isPoS = 0;
} }
else else
@@ -1450,7 +1451,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_
bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED); bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED);
if ( bhash < bnTarget ) if ( bhash < bnTarget )
{ {
fprintf(stderr,"ht.%d isPoS but meets PoW diff!\n",height); //fprintf(stderr,"ht.%d isPoS but meets PoW diff!\n",height);
isPoS = 0; isPoS = 0;
} }
} }

View File

@@ -41,10 +41,10 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight)
} else if (authority == CROSSCHAIN_STAKED) { } else if (authority == CROSSCHAIN_STAKED) {
// We need to create auth_STAKED dynamically here based on timestamp // We need to create auth_STAKED dynamically here based on timestamp
int staked_era = STAKED_era(timestamp); int staked_era = STAKED_era(timestamp);
printf("ERA.(%d) \n",staked_era); //printf("ERA.(%d) \n",staked_era);
if (staked_era == 0) { if (staked_era == 0) {
// this is an ERA GAP, so we will ignore this notarization // this is an ERA GAP, so we will ignore this notarization
printf("Notarization for %s occured inside an ERA GAP, we will ignore it! \n",data.symbol); //printf("Notarization for %s occured inside an ERA GAP, we will ignore it! \n",data.symbol);
continue; continue;
} else { } else {
// pass era slection off to notaries_staked.cpp file // pass era slection off to notaries_staked.cpp file
@@ -52,12 +52,12 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight)
} }
if (!CheckTxAuthority(tx, auth_STAKED)) if (!CheckTxAuthority(tx, auth_STAKED))
continue; continue;
printf("Authorised notarisation data for %s \n",data.symbol); //printf("Authorised notarisation data for %s \n",data.symbol);
} }
if (parsed) { if (parsed) {
vNotarisations.push_back(std::make_pair(tx.GetHash(), data)); vNotarisations.push_back(std::make_pair(tx.GetHash(), data));
printf("Added notarisation data for %s \n",data.symbol); //printf("Added notarisation data for %s \n",data.symbol);
//printf("Parsed a notarisation for: %s, txid:%s, ccid:%i, momdepth:%i\n", //printf("Parsed a notarisation for: %s, txid:%s, ccid:%i, momdepth:%i\n",
// data.symbol, tx.GetHash().GetHex().data(), data.ccId, data.MoMDepth); // data.symbol, tx.GetHash().GetHex().data(), data.ccId, data.MoMDepth);
//if (!data.MoMoM.IsNull()) printf("MoMoM:%s\n", data.MoMoM.GetHex().data()); //if (!data.MoMoM.IsNull()) printf("MoMoM:%s\n", data.MoMoM.GetHex().data());