Compare commits

..

No commits in common. "fbbb9d30fcb1124941ff7f5aea0ced8dc6193218" and "579565761248b5f2a4f77755f177e325eb9e6c5a" have entirely different histories.

2 changed files with 19 additions and 35 deletions

View File

@ -724,7 +724,6 @@ int32_t hush_block2height(CBlock *block)
return(height);
}
// return true if the first output of the first tx in a block is valid
int32_t hush_block2pubkey33(uint8_t *pubkey33,CBlock *block)
{
int32_t n;
@ -1617,29 +1616,10 @@ void GetHushEarlytxidScriptPub()
int64_t hush_checkcommission(CBlock *pblock,int32_t height)
{
if(fDebug)
fprintf(stderr,"%s at height=%d\n",__func__,height);
int64_t checktoshis=0; uint8_t *script,scripthex[8192]; int32_t scriptlen,matched = 0; static bool didinit = false;
//if(fDebug)
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
{
int32_t i;
fprintf(stderr,"%s: height=%d ASSETCHAINS_SCRIPTPUB=",__func__,height);
for (i=0; i<ASSETCHAINS_SCRIPTPUB.size(); i++) {
fprintf(stderr,"%02x",ASSETCHAINS_SCRIPTPUB[i]);
}
fprintf(stderr," size=%d\n", ASSETCHAINS_SCRIPTPUB.size());
}
ASSETCHAINS_SCRIPTPUB = devtax_scriptpub_for_height(height);
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
{
int32_t i;
fprintf(stderr,"%s: devtax_scriptpub_for_height(%d)=",__func__,height);
for (i=0; i<ASSETCHAINS_SCRIPTPUB.size(); i++) {
fprintf(stderr,"%02x",ASSETCHAINS_SCRIPTPUB[i]);
}
fprintf(stderr," size=%d\n", ASSETCHAINS_SCRIPTPUB.size());
}
if ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0 )
{
checktoshis = the_commission(pblock,height);
@ -1652,14 +1632,12 @@ int64_t hush_checkcommission(CBlock *pblock,int32_t height)
{
script = (uint8_t *)&pblock->vtx[0].vout[1].scriptPubKey[0];
scriptlen = (int32_t)pblock->vtx[0].vout[1].scriptPubKey.size();
if ( 1 ) // fDebug )
if ( fDebug )
{
int32_t i;
fprintf(stderr, "%s: script=", __func__);
for (i=0; i<scriptlen; i++)
fprintf(stderr,"%02x",script[i]);
// fprintf(stderr," vout[1] %.8f vs %.8f\n",(double)checktoshis/COIN,(double)pblock->vtx[0].vout[1].nValue/COIN);
fprintf(stderr," scriptlen=%d\n", scriptlen);
fprintf(stderr," vout[1] %.8f vs %.8f\n",(double)checktoshis/COIN,(double)pblock->vtx[0].vout[1].nValue/COIN);
}
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
{
@ -1674,10 +1652,6 @@ int64_t hush_checkcommission(CBlock *pblock,int32_t height)
decode_hex(scripthex,scriptlen,(char *)ASSETCHAINS_SCRIPTPUB.c_str());
if ( memcmp(scripthex,script,scriptlen) == 0 )
matched = scriptlen;
else
fprintf(stderr,"%s: ASSETCHAINS_SCRIPTPUB != script\n", __func__);
} else {
fprintf(stderr,"%s: ASSETCHAINS_SCRIPTPUB is incorrect size! scriptlen=%d sizeof(scriptlen)=%d\n", __func__, scriptlen, sizeof(scripthex) );
}
}
else if ( scriptlen == 35 && script[0] == 33 && script[34] == OP_CHECKSIG && memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) == 0 )
@ -1718,8 +1692,7 @@ bool HUSH_TEST_ASSETCHAIN_SKIP_POW = 0;
int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
{
uint256 hash,merkleroot; arith_uint256 bnTarget,bhash; bool fNegative,fOverflow; uint8_t *script,pubkey33[33];
int32_t i,scriptlen,possible,PoSperc,is_PoSblock=0,n,failed = 0,notaryid = -1; int64_t checktoshis,value; CBlockIndex *pprev;
uint256 hash,merkleroot; arith_uint256 bnTarget,bhash; bool fNegative,fOverflow; uint8_t *script,pubkey33[33],pubkeys[64][33]; int32_t i,scriptlen,possible,PoSperc,is_PoSblock=0,n,failed = 0,notaryid = -1; int64_t checktoshis,value; CBlockIndex *pprev;
if ( HUSH_TEST_ASSETCHAIN_SKIP_POW == 0 && Params().NetworkIDString() == "regtest" )
HUSH_TEST_ASSETCHAIN_SKIP_POW = 1;
if ( !CheckEquihashSolution(pblock, Params()) )
@ -1745,7 +1718,18 @@ int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
if ( (SMART_CHAIN_SYMBOL[0] != 0) && bhash > bnTarget ) {
failed = 1;
if ( possible == 0 || SMART_CHAIN_SYMBOL[0] != 0 ) {
if ( height > 0 && SMART_CHAIN_SYMBOL[0] == 0 ) // for the fast case
{
if ( (n= hush_notaries(pubkeys,height,pblock->nTime)) > 0 )
{
for (i=0; i<n; i++)
if ( memcmp(pubkey33,pubkeys[i],33) == 0 )
{
notaryid = i;
break;
}
}
} else if ( possible == 0 || SMART_CHAIN_SYMBOL[0] != 0 ) {
if ( HUSH_TEST_ASSETCHAIN_SKIP_POW )
return(0);
if ( ASSETCHAINS_STAKED == 0 )

View File

@ -858,7 +858,7 @@ int32_t unhex(char c)
int32_t hex;
if ( (hex= _unhex(c)) < 0 )
{
fprintf(stderr,"unhex: illegal hexchar.(%c)\n",c);
//printf("unhex: illegal hexchar.(%c)\n",c);
}
return(hex);
}
@ -868,7 +868,7 @@ unsigned char _decode_hex(char *hex) { return((unhex(hex[0])<<4) | unhex(hex[1])
int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex)
{
int32_t adjust,i = 0;
fprintf(stderr,"%s(%s) n=%d\n",__func__, hex, n);
//printf("decode.(%s)\n",hex);
if ( is_hexstr(hex,n) <= 0 )
{
memset(bytes,0,n);