mirror of
https://git.hush.is/hush/hush3.git
synced 2025-09-04 00:02:39 -04:00
Merge remote-tracking branch 'jl/dev' into momo
This commit is contained in:
commit
c3aa599831
@ -34,68 +34,5 @@ echo $pubkey
|
|||||||
./komodod -pubkey=$pubkey -ac_name=DSEC -ac_supply=7000000 -addnode=185.148.147.30 &
|
./komodod -pubkey=$pubkey -ac_name=DSEC -ac_supply=7000000 -addnode=185.148.147.30 &
|
||||||
./komodod -pubkey=$pubkey -ac_name=GLXT -ac_supply=100000000 -addnode=13.230.224.15 &
|
./komodod -pubkey=$pubkey -ac_name=GLXT -ac_supply=100000000 -addnode=13.230.224.15 &
|
||||||
./komodod -pubkey=$pubkey -ac_name=EQL -ac_supply=500000000 -addnode=46.101.124.153 &
|
./komodod -pubkey=$pubkey -ac_name=EQL -ac_supply=500000000 -addnode=46.101.124.153 &
|
||||||
#sleep $delay
|
~/VerusCoin/src/komodod -ac_name=VRSC -ac_algo=verushash -ac_cc=1 -ac_veruspos=50 -ac_supply=0 -ac_eras=3 -ac_reward=0,38400000000,2400000000 -ac_halving=1,43200,1051920 -ac_decay=100000000,0,0 -ac_end=10080,226080,0 -ac_timelockgte=19200000000 -ac_timeunlockfrom=129600 -ac_timeunlockto=1180800 -addnode=185.25.48.236 -addnode=185.64.105.111 &
|
||||||
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=EUR -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=JPY -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=GBP -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=AUD -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=CAD -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=CHF -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=NZD -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=CNY -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=RUB -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=MXN -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=BRL -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=INR -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=HKD -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=TRY -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=ZAR -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=PLN -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=NOK -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=SEK -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=DKK -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=CZK -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=HUF -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=ILS -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=KRW -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=MYR -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=PHP -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=RON -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=SGD -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=THB -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=BGN -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=IDR -addnode=78.47.196.146 $1 &
|
|
||||||
#sleep $delay
|
|
||||||
#./komodod -pubkey=$pubkey -ac_name=HRK -addnode=78.47.196.146 $1 &
|
|
||||||
|
24
src/komodo.h
24
src/komodo.h
@ -113,7 +113,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
|
|||||||
if ( fread(&MoMdepth,1,sizeof(MoMdepth),fp) != sizeof(MoMdepth) )
|
if ( fread(&MoMdepth,1,sizeof(MoMdepth),fp) != sizeof(MoMdepth) )
|
||||||
errs++;
|
errs++;
|
||||||
if ( 1 && ASSETCHAINS_SYMBOL[0] != 0 && sp != 0 )
|
if ( 1 && ASSETCHAINS_SYMBOL[0] != 0 && sp != 0 )
|
||||||
printf("%s load[%s.%d -> %s] NOTARIZED %d %s MoM.%s %d\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,dest,notarized_height,notarized_hash.ToString().c_str(),MoM.ToString().c_str(),MoMdepth);
|
printf("%s load[%s.%d -> %s] NOTARIZED %d %s MoM.%s %d CCid.%u\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,dest,notarized_height,notarized_hash.ToString().c_str(),MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -201,8 +201,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
|
|||||||
komodo_eventadd_pricefeed(sp,symbol,ht,pvals,numpvals);
|
komodo_eventadd_pricefeed(sp,symbol,ht,pvals,numpvals);
|
||||||
//printf("load pvals ht.%d numpvals.%d\n",ht,numpvals);
|
//printf("load pvals ht.%d numpvals.%d\n",ht,numpvals);
|
||||||
} else printf("error loading pvals[%d]\n",numpvals);
|
} else printf("error loading pvals[%d]\n",numpvals);
|
||||||
}
|
} // else printf("[%s] %s illegal func.(%d %c)\n",ASSETCHAINS_SYMBOL,symbol,func,func);
|
||||||
else printf("[%s] %s illegal func.(%d %c)\n",ASSETCHAINS_SYMBOL,symbol,func,func);
|
|
||||||
return(func);
|
return(func);
|
||||||
} else return(-1);
|
} else return(-1);
|
||||||
}
|
}
|
||||||
@ -259,7 +258,7 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
|
|||||||
if ( memread(&MoMdepth,sizeof(MoMdepth),filedata,&fpos,datalen) != sizeof(MoMdepth) )
|
if ( memread(&MoMdepth,sizeof(MoMdepth),filedata,&fpos,datalen) != sizeof(MoMdepth) )
|
||||||
errs++;
|
errs++;
|
||||||
if ( 1 && ASSETCHAINS_SYMBOL[0] != 0 && sp != 0 )
|
if ( 1 && ASSETCHAINS_SYMBOL[0] != 0 && sp != 0 )
|
||||||
printf("%s load[%s.%d -> %s] NOTARIZED %d %s MoM.%s %d\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,dest,notarized_height,notarized_hash.ToString().c_str(),MoM.ToString().c_str(),MoMdepth);
|
printf("%s load[%s.%d -> %s] NOTARIZED %d %s MoM.%s %d CCid.%u\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,dest,notarized_height,notarized_hash.ToString().c_str(),MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -342,8 +341,7 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
|
|||||||
komodo_eventadd_pricefeed(sp,symbol,ht,pvals,numpvals);
|
komodo_eventadd_pricefeed(sp,symbol,ht,pvals,numpvals);
|
||||||
//printf("load pvals ht.%d numpvals.%d\n",ht,numpvals);
|
//printf("load pvals ht.%d numpvals.%d\n",ht,numpvals);
|
||||||
} else printf("error loading pvals[%d]\n",numpvals);
|
} else printf("error loading pvals[%d]\n",numpvals);
|
||||||
}
|
} // else printf("[%s] %s illegal func.(%d %c)\n",ASSETCHAINS_SYMBOL,symbol,func,func);
|
||||||
else printf("[%s] %s illegal func.(%d %c)\n",ASSETCHAINS_SYMBOL,symbol,func,func);
|
|
||||||
*fposp = fpos;
|
*fposp = fpos;
|
||||||
return(func);
|
return(func);
|
||||||
}
|
}
|
||||||
@ -482,7 +480,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
|
|||||||
//printf("ht.%d func N ht.%d errs.%d\n",height,NOTARIZED_HEIGHT,errs);
|
//printf("ht.%d func N ht.%d errs.%d\n",height,NOTARIZED_HEIGHT,errs);
|
||||||
if ( sp != 0 )
|
if ( sp != 0 )
|
||||||
{
|
{
|
||||||
if ( sp->MoMdepth > 0 && sp->MoM != zero )
|
if ( sp->MoMdepth != 0 && sp->MoM != zero )
|
||||||
fputc('M',fp);
|
fputc('M',fp);
|
||||||
else fputc('N',fp);
|
else fputc('N',fp);
|
||||||
if ( fwrite(&height,1,sizeof(height),fp) != sizeof(height) )
|
if ( fwrite(&height,1,sizeof(height),fp) != sizeof(height) )
|
||||||
@ -493,7 +491,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
|
|||||||
errs++;
|
errs++;
|
||||||
if ( fwrite(&sp->NOTARIZED_DESTTXID,1,sizeof(sp->NOTARIZED_DESTTXID),fp) != sizeof(sp->NOTARIZED_DESTTXID) )
|
if ( fwrite(&sp->NOTARIZED_DESTTXID,1,sizeof(sp->NOTARIZED_DESTTXID),fp) != sizeof(sp->NOTARIZED_DESTTXID) )
|
||||||
errs++;
|
errs++;
|
||||||
if ( sp->MoMdepth > 0 && sp->MoM != zero )
|
if ( sp->MoMdepth != 0 && sp->MoM != zero )
|
||||||
{
|
{
|
||||||
if ( fwrite(&sp->MoM,1,sizeof(sp->MoM),fp) != sizeof(sp->MoM) )
|
if ( fwrite(&sp->MoM,1,sizeof(sp->MoM),fp) != sizeof(sp->MoM) )
|
||||||
errs++;
|
errs++;
|
||||||
@ -643,10 +641,12 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
|
|||||||
len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&MoM);
|
len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&MoM);
|
||||||
len += iguana_rwnum(0,&scriptbuf[len],sizeof(MoMdepth),(uint8_t *)&MoMdepth);
|
len += iguana_rwnum(0,&scriptbuf[len],sizeof(MoMdepth),(uint8_t *)&MoMdepth);
|
||||||
ccdata.MoMdata.MoM = MoM;
|
ccdata.MoMdata.MoM = MoM;
|
||||||
ccdata.MoMdata.MoMdepth = MoMdepth;
|
ccdata.MoMdata.MoMdepth = MoMdepth & 0xffff;
|
||||||
if ( len+sizeof(ccdata.CCid)-opoffset <= opretlen )
|
if ( len+sizeof(ccdata.CCid)-opoffset <= opretlen )
|
||||||
{
|
{
|
||||||
len += iguana_rwnum(0,&scriptbuf[len],sizeof(ccdata.CCid),(uint8_t *)&ccdata.CCid);
|
len += iguana_rwnum(0,&scriptbuf[len],sizeof(ccdata.CCid),(uint8_t *)&ccdata.CCid);
|
||||||
|
if ( ((MoMdepth>>16) & 0xffff) != (ccdata.CCid & 0xffff) )
|
||||||
|
fprintf(stderr,"%s CCid mismatch %u != %u\n",ASSETCHAINS_SYMBOL,((MoMdepth>>16) & 0xffff),(ccdata.CCid & 0xffff));
|
||||||
ccdata.len = sizeof(ccdata.CCid);
|
ccdata.len = sizeof(ccdata.CCid);
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
{
|
{
|
||||||
@ -672,7 +672,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
|
|||||||
} else ccdata.len = MoMoMdata.len = 0;
|
} else ccdata.len = MoMoMdata.len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( MoM == zero || MoMdepth > *notarizedheightp || MoMdepth < 0 )
|
if ( MoM == zero || (MoMdepth&0xffff) > *notarizedheightp || (MoMdepth&0xffff) < 0 )
|
||||||
{
|
{
|
||||||
memset(&MoM,0,sizeof(MoM));
|
memset(&MoM,0,sizeof(MoM));
|
||||||
MoMdepth = 0;
|
MoMdepth = 0;
|
||||||
@ -681,7 +681,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
|
|||||||
{
|
{
|
||||||
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]\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth);
|
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);
|
||||||
@ -695,7 +695,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
|
|||||||
sp->NOTARIZED_HEIGHT = *notarizedheightp;
|
sp->NOTARIZED_HEIGHT = *notarizedheightp;
|
||||||
sp->NOTARIZED_HASH = srchash;
|
sp->NOTARIZED_HASH = srchash;
|
||||||
sp->NOTARIZED_DESTTXID = desttxid;
|
sp->NOTARIZED_DESTTXID = desttxid;
|
||||||
if ( MoM != zero && MoMdepth > 0 )
|
if ( MoM != zero && (MoMdepth&0xffff) > 0 )
|
||||||
{
|
{
|
||||||
sp->MoM = MoM;
|
sp->MoM = MoM;
|
||||||
sp->MoMdepth = MoMdepth;
|
sp->MoMdepth = MoMdepth;
|
||||||
|
@ -932,7 +932,7 @@ int32_t komodo_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *kmdtxidp,in
|
|||||||
memset(MoMp,0,sizeof(*MoMp));
|
memset(MoMp,0,sizeof(*MoMp));
|
||||||
memset(kmdtxidp,0,sizeof(*kmdtxidp));
|
memset(kmdtxidp,0,sizeof(*kmdtxidp));
|
||||||
*notarized_heightp = 0;
|
*notarized_heightp = 0;
|
||||||
if ( depth > 0 && notarized_ht > 0 && nHeight > notarized_ht-depth && nHeight <= notarized_ht )
|
if ( depth != 0 && notarized_ht > 0 && nHeight > notarized_ht-depth && nHeight <= notarized_ht )
|
||||||
{
|
{
|
||||||
*MoMp = MoM;
|
*MoMp = MoM;
|
||||||
*notarized_heightp = notarized_ht;
|
*notarized_heightp = notarized_ht;
|
||||||
@ -1265,6 +1265,29 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_
|
|||||||
return(isPoS);
|
return(isPoS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t komodo_checkcommission(CBlock *pblock,int32_t height)
|
||||||
|
{
|
||||||
|
int64_t checktoshis=0; uint8_t *script;
|
||||||
|
if ( ASSETCHAINS_COMMISSION != 0 )
|
||||||
|
{
|
||||||
|
checktoshis = komodo_commission(pblock);
|
||||||
|
if ( checktoshis > 10000 && pblock->vtx[0].vout.size() != 2 )
|
||||||
|
return(-1);
|
||||||
|
else if ( checktoshis != 0 )
|
||||||
|
{
|
||||||
|
script = (uint8_t *)pblock->vtx[0].vout[1].scriptPubKey.data();
|
||||||
|
if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 )
|
||||||
|
return(-1);
|
||||||
|
if ( pblock->vtx[0].vout[1].nValue != checktoshis )
|
||||||
|
{
|
||||||
|
fprintf(stderr,"ht.%d checktoshis %.8f vs actual vout[1] %.8f\n",height,dstr(checktoshis),dstr(pblock->vtx[0].vout[1].nValue));
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(checktoshis);
|
||||||
|
}
|
||||||
|
|
||||||
bool KOMODO_TEST_ASSETCHAIN_SKIP_POW = 0;
|
bool KOMODO_TEST_ASSETCHAIN_SKIP_POW = 0;
|
||||||
|
|
||||||
int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
||||||
@ -1336,21 +1359,18 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
|||||||
} else if ( is_PoSblock < 0 )
|
} else if ( is_PoSblock < 0 )
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
if ( failed == 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 )
|
if ( failed == 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
|
||||||
{
|
{
|
||||||
checktoshis = komodo_commission(pblock);
|
if ( height == 1 )
|
||||||
if ( checktoshis > 10000 && pblock->vtx[0].vout.size() != 2 )
|
|
||||||
return(-1);
|
|
||||||
else if ( checktoshis != 0 )
|
|
||||||
{
|
{
|
||||||
script = (uint8_t *)pblock->vtx[0].vout[1].scriptPubKey.data();
|
script = (uint8_t *)pblock->vtx[0].vout[0].scriptPubKey.data();
|
||||||
if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 )
|
if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 )
|
||||||
return(-1);
|
return(-1);
|
||||||
if ( pblock->vtx[0].vout[1].nValue != checktoshis )
|
}
|
||||||
{
|
else
|
||||||
fprintf(stderr,"checktoshis %.8f vs actual vout[1] %.8f\n",dstr(checktoshis),dstr(pblock->vtx[0].vout[1].nValue));
|
{
|
||||||
|
if ( komodo_checkcommission(pblock,height) < 0 )
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//fprintf(stderr,"komodo_checkPOW possible.%d slowflag.%d ht.%d notaryid.%d failed.%d\n",possible,slowflag,height,notaryid,failed);
|
//fprintf(stderr,"komodo_checkPOW possible.%d slowflag.%d ht.%d notaryid.%d failed.%d\n",possible,slowflag,height,notaryid,failed);
|
||||||
|
@ -25,6 +25,7 @@ uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth)
|
|||||||
{
|
{
|
||||||
static uint256 zero; CBlockIndex *pindex; int32_t i; std::vector<uint256> tree, leaves;
|
static uint256 zero; CBlockIndex *pindex; int32_t i; std::vector<uint256> tree, leaves;
|
||||||
bool fMutated;
|
bool fMutated;
|
||||||
|
MoMdepth &= 0xffff;
|
||||||
if ( MoMdepth >= height )
|
if ( MoMdepth >= height )
|
||||||
return(zero);
|
return(zero);
|
||||||
for (i=0; i<MoMdepth; i++)
|
for (i=0; i<MoMdepth; i++)
|
||||||
|
@ -653,7 +653,7 @@ void komodo_passport_iteration();
|
|||||||
int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtime) // verify above block is valid pax pricing
|
int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtime) // verify above block is valid pax pricing
|
||||||
{
|
{
|
||||||
static uint256 array[64]; static int32_t numbanned,indallvouts;
|
static uint256 array[64]; static int32_t numbanned,indallvouts;
|
||||||
int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,notmatched=0,matched=0,kmdheights[256],otherheights[256]; uint256 hash,txids[256]; char symbol[KOMODO_ASSETCHAIN_MAXLEN],base[KOMODO_ASSETCHAIN_MAXLEN]; uint16_t vouts[256]; int8_t baseids[256]; uint8_t *script,opcode,rmd160s[256*20]; uint64_t total,subsidy,available,deposited,issued,withdrawn,approved,redeemed,checktoshis,seed; int64_t values[256],srcvalues[256]; struct pax_transaction *pax; struct komodo_state *sp; CTransaction tx;
|
int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,notmatched=0,matched=0,kmdheights[256],otherheights[256]; uint256 hash,txids[256]; char symbol[KOMODO_ASSETCHAIN_MAXLEN],base[KOMODO_ASSETCHAIN_MAXLEN]; uint16_t vouts[256]; int8_t baseids[256]; uint8_t *script,opcode,rmd160s[256*20]; uint64_t total,subsidy,available,deposited,issued,withdrawn,approved,redeemed,seed; int64_t checktoshis,values[256],srcvalues[256]; struct pax_transaction *pax; struct komodo_state *sp; CTransaction tx;
|
||||||
activation = 235300;
|
activation = 235300;
|
||||||
if ( *(int32_t *)&array[0] == 0 )
|
if ( *(int32_t *)&array[0] == 0 )
|
||||||
numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
|
numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
|
||||||
@ -743,11 +743,20 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( overflow != 0 || total > 0 || strangeout != 0 )
|
checktoshis = 0;
|
||||||
|
if ( ASSETCHAINS_COMMISSION != 0 && height > 1 )
|
||||||
{
|
{
|
||||||
if ( strangeout != 0 )
|
if ( (checktoshis= komodo_checkcommission((CBlock *)&block,height)) < 0 )
|
||||||
fprintf(stderr,">>>>>>>>>>>>> %s DUST ht.%d strangout.%d notmatched.%d <<<<<<<<<\n",ASSETCHAINS_SYMBOL,height,strangeout,notmatched);
|
return(-1);
|
||||||
return(-1);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( overflow != 0 || total > checktoshis || strangeout != 0 )
|
||||||
|
{
|
||||||
|
if ( strangeout != 0 )
|
||||||
|
fprintf(stderr,">>>>>>>>>>>>> %s DUST ht.%d strangout.%d notmatched.%d <<<<<<<<<\n",ASSETCHAINS_SYMBOL,height,strangeout,notmatched);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -393,7 +393,7 @@ struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx)
|
|||||||
{
|
{
|
||||||
*idx = i;
|
*idx = i;
|
||||||
np = &sp->NPOINTS[i];
|
np = &sp->NPOINTS[i];
|
||||||
if ( np->MoMdepth > 0 && height > np->notarized_height-np->MoMdepth && height <= np->notarized_height )
|
if ( np->MoMdepth != 0 && height > np->notarized_height-(np->MoMdepth&0xffff) && height <= np->notarized_height )
|
||||||
return(np);
|
return(np);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -464,7 +464,7 @@ int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,in
|
|||||||
*MoMoMdepthp = np->MoMoMdepth;
|
*MoMoMdepthp = np->MoMoMdepth;
|
||||||
*kmdstartip = np->kmdstarti;
|
*kmdstartip = np->kmdstarti;
|
||||||
*kmdendip = np->kmdendi;
|
*kmdendip = np->kmdendi;
|
||||||
return(np->MoMdepth);
|
return(np->MoMdepth & 0xffff);
|
||||||
}
|
}
|
||||||
*notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0;
|
*notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0;
|
||||||
memset(MoMp,0,sizeof(*MoMp));
|
memset(MoMp,0,sizeof(*MoMp));
|
||||||
|
@ -809,7 +809,7 @@ uint16_t komodo_calcport(char *name,uint64_t supply,uint64_t endsubsidy,uint64_t
|
|||||||
decay = 0;
|
decay = 0;
|
||||||
printf("decay cant be more than 100000000\n");
|
printf("decay cant be more than 100000000\n");
|
||||||
}
|
}
|
||||||
if ( endsubsidy != 0 || reward != 0 || halving != 0 || decay != 0 || commission != 0 || cc != 0 || staked != 0 )
|
if ( endsubsidy != 0 || reward != 0 || halving != 0 || decay != 0 || commission != 0 || cc != 0 || staked != 0 || ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
|
||||||
{
|
{
|
||||||
//printf("end.%llu reward.%llu halving.%llu decay.%llu perc.%llu\n",(long long)endsubsidy,(long long)reward,(long long)halving,(long long)decay,(long long)commission);
|
//printf("end.%llu reward.%llu halving.%llu decay.%llu perc.%llu\n",(long long)endsubsidy,(long long)reward,(long long)halving,(long long)decay,(long long)commission);
|
||||||
extraptr = extrabuf;
|
extraptr = extrabuf;
|
||||||
|
@ -1559,7 +1559,7 @@ void komodo_args(char *argv0)
|
|||||||
ASSETCHAINS_DECAY = 0;
|
ASSETCHAINS_DECAY = 0;
|
||||||
printf("ASSETCHAINS_DECAY cant be more than 100000000\n");
|
printf("ASSETCHAINS_DECAY cant be more than 100000000\n");
|
||||||
}
|
}
|
||||||
if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 && ASSETCHAINS_COMMISSION > 0 && ASSETCHAINS_COMMISSION <= 100000000 )
|
if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 )
|
||||||
decode_hex(ASSETCHAINS_OVERRIDE_PUBKEY33,33,(char *)ASSETCHAINS_OVERRIDE_PUBKEY.c_str());
|
decode_hex(ASSETCHAINS_OVERRIDE_PUBKEY33,33,(char *)ASSETCHAINS_OVERRIDE_PUBKEY.c_str());
|
||||||
else if ( ASSETCHAINS_COMMISSION != 0 )
|
else if ( ASSETCHAINS_COMMISSION != 0 )
|
||||||
{
|
{
|
||||||
|
@ -5200,10 +5200,11 @@ void static CheckBlockIndex()
|
|||||||
// Build forward-pointing map of the entire block tree.
|
// Build forward-pointing map of the entire block tree.
|
||||||
std::multimap<CBlockIndex*,CBlockIndex*> forward;
|
std::multimap<CBlockIndex*,CBlockIndex*> forward;
|
||||||
for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) {
|
for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) {
|
||||||
forward.insert(std::make_pair(it->second->pprev, it->second));
|
if ( it->second != 0 )
|
||||||
|
forward.insert(std::make_pair(it->second->pprev, it->second));
|
||||||
}
|
}
|
||||||
|
if ( Params().NetworkIDString() != "regtest" )
|
||||||
assert(forward.size() == mapBlockIndex.size());
|
assert(forward.size() == mapBlockIndex.size());
|
||||||
|
|
||||||
std::pair<std::multimap<CBlockIndex*,CBlockIndex*>::iterator,std::multimap<CBlockIndex*,CBlockIndex*>::iterator> rangeGenesis = forward.equal_range(NULL);
|
std::pair<std::multimap<CBlockIndex*,CBlockIndex*>::iterator,std::multimap<CBlockIndex*,CBlockIndex*>::iterator> rangeGenesis = forward.equal_range(NULL);
|
||||||
CBlockIndex *pindex = rangeGenesis.first->second;
|
CBlockIndex *pindex = rangeGenesis.first->second;
|
||||||
|
@ -109,7 +109,8 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams,
|
|||||||
extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE;
|
extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE;
|
||||||
extern uint64_t ASSETCHAINS_REWARD,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED;
|
extern uint64_t ASSETCHAINS_REWARD,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED;
|
||||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||||
extern std::string NOTARY_PUBKEY;
|
extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY;
|
||||||
|
|
||||||
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
|
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
|
||||||
uint32_t Mining_start,Mining_height;
|
uint32_t Mining_start,Mining_height;
|
||||||
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
|
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
|
||||||
@ -447,7 +448,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
txNew.vin[0].scriptSig = CScript() << nHeight << OP_0;
|
txNew.vin[0].scriptSig = CScript() << nHeight << OP_0;
|
||||||
|
|
||||||
pblock->vtx[0] = txNew;
|
pblock->vtx[0] = txNew;
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 && (commission= komodo_commission((CBlock*)&pblocktemplate->block)) != 0 )
|
if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 && (commission= komodo_commission((CBlock*)&pblocktemplate->block)) != 0 )
|
||||||
{
|
{
|
||||||
int32_t i; uint8_t *ptr;
|
int32_t i; uint8_t *ptr;
|
||||||
txNew.vout.resize(2);
|
txNew.vout.resize(2);
|
||||||
@ -486,11 +487,13 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
pblock->nTime = pindexPrev->nTime + 65;
|
pblock->nTime = pindexPrev->nTime + 65;
|
||||||
if ( komodo_notaryvin(txNotary,NOTARY_PUBKEY33) > 0 )
|
if ( komodo_notaryvin(txNotary,NOTARY_PUBKEY33) > 0 )
|
||||||
{
|
{
|
||||||
CAmount txfees = 0;
|
CAmount txfees = 5000;
|
||||||
pblock->vtx.push_back(txNotary);
|
pblock->vtx.push_back(txNotary);
|
||||||
pblocktemplate->vTxFees.push_back(txfees);
|
pblocktemplate->vTxFees.push_back(txfees);
|
||||||
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txNotary));
|
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txNotary));
|
||||||
nFees += txfees;
|
nFees += txfees;
|
||||||
|
pblocktemplate->vTxFees[0] = -nFees;
|
||||||
|
//*(uint64_t *)(&pblock->vtx[0].vout[0].nValue) += txfees;
|
||||||
//fprintf(stderr,"added notaryvin\n");
|
//fprintf(stderr,"added notaryvin\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -590,10 +593,14 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
|
|||||||
// Internal miner
|
// Internal miner
|
||||||
//
|
//
|
||||||
|
|
||||||
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
|
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight)
|
||||||
{
|
{
|
||||||
CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i;
|
CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i;
|
||||||
if ( USE_EXTERNAL_PUBKEY != 0 )
|
if ( nHeight == 1 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
|
||||||
|
{
|
||||||
|
scriptPubKey = CScript() << ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY) << OP_CHECKSIG;
|
||||||
|
}
|
||||||
|
else if ( USE_EXTERNAL_PUBKEY != 0 )
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"use notary pubkey\n");
|
//fprintf(stderr,"use notary pubkey\n");
|
||||||
scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
|
scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
|
||||||
@ -795,7 +802,7 @@ void static BitcoinMiner()
|
|||||||
sleep(3);
|
sleep(3);
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey);
|
CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey,pindexPrev->nHeight+1);
|
||||||
#else
|
#else
|
||||||
CBlockTemplate *ptr = CreateNewBlockWithKey();
|
CBlockTemplate *ptr = CreateNewBlockWithKey();
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,7 +30,7 @@ struct CBlockTemplate
|
|||||||
CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn);
|
CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn);
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
boost::optional<CScript> GetMinerScriptPubKey(CReserveKey& reservekey);
|
boost::optional<CScript> GetMinerScriptPubKey(CReserveKey& reservekey);
|
||||||
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey);
|
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight);
|
||||||
#else
|
#else
|
||||||
boost::optional<CScript> GetMinerScriptPubKey();
|
boost::optional<CScript> GetMinerScriptPubKey();
|
||||||
CBlockTemplate* CreateNewBlockWithKey();
|
CBlockTemplate* CreateNewBlockWithKey();
|
||||||
|
@ -86,6 +86,8 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param
|
|||||||
unsigned int n = params.EquihashN();
|
unsigned int n = params.EquihashN();
|
||||||
unsigned int k = params.EquihashK();
|
unsigned int k = params.EquihashK();
|
||||||
|
|
||||||
|
if ( Params().NetworkIDString() == "regtest" )
|
||||||
|
return(true);
|
||||||
// Hash state
|
// Hash state
|
||||||
crypto_generichash_blake2b_state state;
|
crypto_generichash_blake2b_state state;
|
||||||
EhInitialiseState(n, k, state);
|
EhInitialiseState(n, k, state);
|
||||||
|
@ -214,7 +214,7 @@ UniValue generate(const UniValue& params, bool fHelp)
|
|||||||
lastTime = GetTime();
|
lastTime = GetTime();
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
|
std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey,nHeight));
|
||||||
#else
|
#else
|
||||||
std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey());
|
std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey());
|
||||||
#endif
|
#endif
|
||||||
@ -639,7 +639,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
CReserveKey reservekey(pwalletMain);
|
CReserveKey reservekey(pwalletMain);
|
||||||
pblocktemplate = CreateNewBlockWithKey(reservekey);
|
pblocktemplate = CreateNewBlockWithKey(reservekey,chainActive.Tip()->nHeight+1);
|
||||||
#else
|
#else
|
||||||
pblocktemplate = CreateNewBlockWithKey();
|
pblocktemplate = CreateNewBlockWithKey();
|
||||||
#endif
|
#endif
|
||||||
|
@ -2696,6 +2696,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
uint64_t komodo_interestsum()
|
uint64_t komodo_interestsum()
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_WALLET
|
||||||
uint64_t interest,sum = 0; int32_t txheight; uint32_t locktime;
|
uint64_t interest,sum = 0; int32_t txheight; uint32_t locktime;
|
||||||
vector<COutput> vecOutputs;
|
vector<COutput> vecOutputs;
|
||||||
assert(pwalletMain != NULL);
|
assert(pwalletMain != NULL);
|
||||||
@ -2719,6 +2720,9 @@ uint64_t komodo_interestsum()
|
|||||||
KOMODO_INTERESTSUM = sum;
|
KOMODO_INTERESTSUM = sum;
|
||||||
KOMODO_WALLETBALANCE = pwalletMain->GetBalance();
|
KOMODO_WALLETBALANCE = pwalletMain->GetBalance();
|
||||||
return(sum);
|
return(sum);
|
||||||
|
#else
|
||||||
|
return(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue fundrawtransaction(const UniValue& params, bool fHelp)
|
UniValue fundrawtransaction(const UniValue& params, bool fHelp)
|
||||||
@ -4519,7 +4523,7 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33)
|
|||||||
|
|
||||||
txNew.vin.resize(1);
|
txNew.vin.resize(1);
|
||||||
txNew.vout.resize(1);
|
txNew.vout.resize(1);
|
||||||
txfee = utxovalue / 2;;
|
txfee = utxovalue / 2;
|
||||||
//for (i=0; i<32; i++)
|
//for (i=0; i<32; i++)
|
||||||
// ((uint8_t *)&revtxid)[i] = ((uint8_t *)&utxotxid)[31 - i];
|
// ((uint8_t *)&revtxid)[i] = ((uint8_t *)&utxotxid)[31 - i];
|
||||||
txNew.vin[0].prevout.hash = utxotxid; //revtxid;
|
txNew.vin[0].prevout.hash = utxotxid; //revtxid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user