Merge pull request #842 from jl777/dev

Dev
This commit is contained in:
jl777
2018-08-25 09:04:35 -11:00
committed by GitHub
5 changed files with 20 additions and 12 deletions

View File

@@ -244,7 +244,9 @@ bool RewardsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
//vout.0: funding CC change or recover normal payout //vout.0: funding CC change or recover normal payout
//vout.1: normal output to unlock address //vout.1: normal output to unlock address
//vout.n-1: opreturn 'U' sbits fundingtxid //vout.n-1: opreturn 'U' sbits fundingtxid
if ( eval->GetTxUnconfirmed(tx.vin[0].prevout.hash,vinTx,hashBlock) == 0 ) if ( fundingtxid == txid )
return eval->Invalid("cant unlock fundingtxid");
else if ( eval->GetTxUnconfirmed(tx.vin[0].prevout.hash,vinTx,hashBlock) == 0 )
return eval->Invalid("always should find vin.0, but didnt"); return eval->Invalid("always should find vin.0, but didnt");
for (i=0; i<numvins; i++) for (i=0; i<numvins; i++)
{ {
@@ -609,6 +611,12 @@ std::string RewardsUnlock(uint64_t txfee,char *planstr,uint256 fundingtxid,uint2
rewardspk = GetUnspendable(cp,0); rewardspk = GetUnspendable(cp,0);
mypk = pubkey2pk(Mypubkey()); mypk = pubkey2pk(Mypubkey());
sbits = stringbits(planstr); sbits = stringbits(planstr);
if ( locktxid == fundingtxid )
{
fprintf(stderr,"Rewards plan cant unlock fundingtxid\n");
CCerror = "Rewards plan cant unlock fundingtxid";
return("");
}
if ( RewardsPlanExists(cp,sbits,rewardspk,APR,minseconds,maxseconds,mindeposit) == 0 ) if ( RewardsPlanExists(cp,sbits,rewardspk,APR,minseconds,maxseconds,mindeposit) == 0 )
{ {
fprintf(stderr,"Rewards plan %s doesnt exist\n",planstr); fprintf(stderr,"Rewards plan %s doesnt exist\n",planstr);

View File

@@ -311,7 +311,7 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
{ {
if ( memread(opret,olen,filedata,&fpos,datalen) != olen ) if ( memread(opret,olen,filedata,&fpos,datalen) != olen )
errs++; errs++;
if ( 1 && ASSETCHAINS_SYMBOL[0] != 0 && matched != 0 ) if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && matched != 0 )
{ {
int32_t i; for (i=0; i<olen; i++) int32_t i; for (i=0; i<olen; i++)
printf("%02x",opret[i]); printf("%02x",opret[i]);
@@ -600,7 +600,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
{ {
if ( scriptbuf[len] == 'K' ) if ( scriptbuf[len] == 'K' )
{ {
fprintf(stderr,"i.%d j.%d KV OPRET len.%d %.8f\n",i,j,opretlen,dstr(value)); //fprintf(stderr,"i.%d j.%d KV OPRET len.%d %.8f\n",i,j,opretlen,dstr(value));
komodo_stateupdate(height,0,0,0,txhash,0,0,0,0,0,0,value,&scriptbuf[len],opretlen,j,zero,0); komodo_stateupdate(height,0,0,0,txhash,0,0,0,0,0,0,value,&scriptbuf[len],opretlen,j,zero,0);
return(-1); return(-1);
} }

View File

@@ -64,7 +64,7 @@ int32_t komodo_kvsearch(uint256 *pubkeyp,int32_t current_height,uint32_t *flagsp
if ( ptr != 0 ) if ( ptr != 0 )
{ {
duration = komodo_kvduration(ptr->flags); duration = komodo_kvduration(ptr->flags);
fprintf(stderr,"duration.%d flags.%d current.%d ht.%d keylen.%d valuesize.%d\n",duration,ptr->flags,current_height,ptr->height,ptr->keylen,ptr->valuesize); //fprintf(stderr,"duration.%d flags.%d current.%d ht.%d keylen.%d valuesize.%d\n",duration,ptr->flags,current_height,ptr->height,ptr->keylen,ptr->valuesize);
if ( current_height > (ptr->height + duration) ) if ( current_height > (ptr->height + duration) )
{ {
HASH_DELETE(hh,KOMODO_KV,ptr); HASH_DELETE(hh,KOMODO_KV,ptr);
@@ -117,7 +117,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value)
} }
valueptr = &key[keylen]; valueptr = &key[keylen];
fee = komodo_kvfee(flags,opretlen,keylen); fee = komodo_kvfee(flags,opretlen,keylen);
printf("fee %.8f vs %.8f flags.%d keylen.%d valuesize.%d height.%d (%02x %02x %02x) (%02x %02x %02x)\n",(double)fee/COIN,(double)value/COIN,flags,keylen,valuesize,height,key[0],key[1],key[2],valueptr[0],valueptr[1],valueptr[2]); //printf("fee %.8f vs %.8f flags.%d keylen.%d valuesize.%d height.%d (%02x %02x %02x) (%02x %02x %02x)\n",(double)fee/COIN,(double)value/COIN,flags,keylen,valuesize,height,key[0],key[1],key[2],valueptr[0],valueptr[1],valueptr[2]);
if ( value >= fee ) if ( value >= fee )
{ {
coresize = (int32_t)(sizeof(flags)+sizeof(height)+sizeof(keylen)+sizeof(valuesize)+keylen+valuesize+1); coresize = (int32_t)(sizeof(flags)+sizeof(height)+sizeof(keylen)+sizeof(valuesize)+keylen+valuesize+1);
@@ -142,7 +142,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value)
{ {
if ( komodo_kvsigverify(keyvalue,keylen+refvaluesize,refpubkey,sig) < 0 ) if ( komodo_kvsigverify(keyvalue,keylen+refvaluesize,refpubkey,sig) < 0 )
{ {
fprintf(stderr,"komodo_kvsigverify error [%d]\n",coresize-13); //fprintf(stderr,"komodo_kvsigverify error [%d]\n",coresize-13);
return; return;
} }
} }
@@ -151,7 +151,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value)
HASH_FIND(hh,KOMODO_KV,key,keylen,ptr); HASH_FIND(hh,KOMODO_KV,key,keylen,ptr);
if ( ptr != 0 ) if ( ptr != 0 )
{ {
fprintf(stderr,"(%s) already there\n",(char *)key); //fprintf(stderr,"(%s) already there\n",(char *)key);
//if ( (ptr->flags & KOMODO_KVPROTECTED) != 0 ) //if ( (ptr->flags & KOMODO_KVPROTECTED) != 0 )
{ {
tstr = (char *)"transfer:"; tstr = (char *)"transfer:";

View File

@@ -736,7 +736,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason, const int nHeight)
if (!::IsStandard(txout.scriptPubKey, whichType)) if (!::IsStandard(txout.scriptPubKey, whichType))
{ {
reason = "scriptpubkey"; reason = "scriptpubkey";
fprintf(stderr,">>>>>>>>>>>>>>> vout.%d nDataout.%d\n",v,nDataOut); //fprintf(stderr,">>>>>>>>>>>>>>> vout.%d nDataout.%d\n",v,nDataOut);
return false; return false;
} }
@@ -1306,7 +1306,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
string reason; string reason;
if (Params().RequireStandard() && !IsStandardTx(tx, reason, nextBlockHeight)) if (Params().RequireStandard() && !IsStandardTx(tx, reason, nextBlockHeight))
{ {
fprintf(stderr,"AcceptToMemoryPool reject nonstandard transaction: %s\n",reason.c_str()); //fprintf(stderr,"AcceptToMemoryPool reject nonstandard transaction: %s\n",reason.c_str());
return state.DoS(0,error("AcceptToMemoryPool: nonstandard transaction: %s", reason),REJECT_NONSTANDARD, reason); return state.DoS(0,error("AcceptToMemoryPool: nonstandard transaction: %s", reason),REJECT_NONSTANDARD, reason);
} }
// Only accept nLockTime-using transactions that can be mined in the next // Only accept nLockTime-using transactions that can be mined in the next
@@ -4187,11 +4187,11 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
} }
if ( rejects == 0 || rejects == lastrejects ) if ( rejects == 0 || rejects == lastrejects )
{ {
if ( lastrejects != 0 ) if ( 0 && lastrejects != 0 )
fprintf(stderr,"lastrejects.%d -> all tx in mempool\n",lastrejects); fprintf(stderr,"lastrejects.%d -> all tx in mempool\n",lastrejects);
break; break;
} }
fprintf(stderr,"addtomempool ht.%d for CC checking: n.%d rejects.%d last.%d\n",height,(int32_t)block.vtx.size(),rejects,lastrejects); //fprintf(stderr,"addtomempool ht.%d for CC checking: n.%d rejects.%d last.%d\n",height,(int32_t)block.vtx.size(),rejects,lastrejects);
lastrejects = rejects; lastrejects = rejects;
rejects = 0; rejects = 0;
} }

View File

@@ -167,7 +167,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
// small pushdata, <= nMaxDatacarrierBytes // small pushdata, <= nMaxDatacarrierBytes
if (vch1.size() > nMaxDatacarrierBytes) if (vch1.size() > nMaxDatacarrierBytes)
{ {
fprintf(stderr,"size.%d > nMaxDatacarrier.%d\n",(int32_t)vch1.size(),(int32_t)nMaxDatacarrierBytes); //fprintf(stderr,"size.%d > nMaxDatacarrier.%d\n",(int32_t)vch1.size(),(int32_t)nMaxDatacarrierBytes);
break; break;
} }
} }