Merge branch 'FSM' into jl777

This commit is contained in:
jl777
2018-12-14 00:24:50 -11:00
3 changed files with 34 additions and 27 deletions

View File

@@ -167,7 +167,7 @@ try_again:
curl_handle = curl_easy_init();
init_string(&s);
headers = curl_slist_append(0,"Expect:");
curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )");
curl_easy_setopt(curl_handle,CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl_handle,CURLOPT_URL, url);
@@ -196,7 +196,7 @@ try_again:
bracket0 = (char *)"[";
bracket1 = (char *)"]";
}
databuf = (char *)malloc(256 + strlen(command) + strlen(params));
sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1);
//printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf);
@@ -236,7 +236,7 @@ try_again:
free(s.ptr);
sleep((1<<numretries));
goto try_again;
}
else
{
@@ -522,7 +522,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
}
return(hash);
}
uint256 _komodo_getblockhash(int32_t height);*/
uint64_t komodo_seed(int32_t height)
@@ -1106,12 +1106,13 @@ int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_
/*
komodo_checkPOW (fast) is called early in the process and should only refer to data immediately available. it is a filter to prevent bad blocks from going into the local DB. The more blocks we can filter out at this stage, the less junk in the local DB that will just get purged later on.
komodo_checkPOW (slow) is called right before connecting blocks so all prior blocks can be assumed to be there and all checks must pass
commission must be in coinbase.vout[1] and must be >= 10000 sats
PoS stake must be without txfee and in the last tx in the block at vout[0]
*/
extern int32_t ASSETCHAINS_FOUNDERS_PERIOD;
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
@@ -1123,11 +1124,14 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
{
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
//fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION));
return((nSubsidy * ASSETCHAINS_COMMISSION) / COIN);
n = pblock->vtx[0].vout.size();
for (j=0; j<n; j++)
if ( j != 1 )
total += pblock->vtx[0].vout[j].nValue;
commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN);
if ( ASSETCHAINS_FOUNDERS_PERIOD != 0 )
{
if ( height % ASSETCHAINS_FOUNDERS_PERIOD == 0 )
commission = commission * ASSETCHAINS_FOUNDERS_PERIOD;
else
commission = 0;
}
}
else
{
@@ -1141,9 +1145,8 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
total += pblock->vtx[i].vout[j].nValue;
}
}
commission = ((total * ASSETCHAINS_COMMISSION) / COIN);
}
//fprintf(stderr,"txn.%d n.%d commission total %.8f -> %.8f\n",txn_count,n,dstr(total),dstr((total * ASSETCHAINS_COMMISSION) / COIN));
commission = ((total * ASSETCHAINS_COMMISSION) / COIN);
if ( commission < 10000 )
commission = 0;
return(commission);
@@ -1545,7 +1548,7 @@ bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height)
{
fprintf(stderr,"ERROR: chain not fully loaded or invalid PoS block %s - no past block found\n",blkHash.ToString().c_str());
}
else
else
#ifndef KOMODO_ZCASH
if (!GetTransaction(txid, tx, Params().GetConsensus(), blkHash, true))
#else
@@ -1578,7 +1581,7 @@ bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height)
{
BlockMap::const_iterator it = mapBlockIndex.find(blkHash);
if ((it == mapBlockIndex.end()) ||
!(pastBlockIndex = it->second) ||
!(pastBlockIndex = it->second) ||
(height - pastBlockIndex->GetHeight()) < VERUS_MIN_STAKEAGE)
{
fprintf(stderr,"ERROR: invalid PoS block %s - stake source too new or not found\n",blkHash.ToString().c_str());
@@ -1695,7 +1698,7 @@ int64_t komodo_checkcommission(CBlock *pblock,int32_t height)
// fprintf(stderr,"%02x",script[i]);
//fprintf(stderr," payment to wrong pubkey scriptlen.%d, scriptpub[%d]\n",scriptlen,(int32_t)ASSETCHAINS_SCRIPTPUB.size()/2);
return(-1);
}
if ( pblock->vtx[0].vout[1].nValue != checktoshis )
{