CC fixes for nSPV and others (#30)
- Remove adding txfee inputs for gateways claim - FULLNODE and SUPERLITE macros - Filter SetCCtxids with txid from oprert - Fix for nServices of fullnode - Use SetCCtxids_nSPV for some more CCs - Fix addnormalinputs and add checking if utxo spent in mempool
This commit is contained in:
committed by
GitHub
parent
450ac5c5ea
commit
a7204d9f85
@@ -629,12 +629,10 @@ bool GatewaysValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &
|
||||
return eval->Invalid("deposit amount greater then bind total supply");
|
||||
else if (komodo_txnotarizedconfirmed(deposittxid) == false)
|
||||
return eval->Invalid("gatewaysdeposit tx is not yet confirmed(notarised)!");
|
||||
else if (IsCCInput(tx.vin[0].scriptSig) != 0)
|
||||
return eval->Invalid("vin.0 is normal for gatewaysclaim!");
|
||||
else if (tx.vin.size()>2)
|
||||
else if (tx.vin.size()>0)
|
||||
{
|
||||
i=1;
|
||||
while (i<=tx.vin.size()-2)
|
||||
i=0;
|
||||
while (i<tx.vin.size()-1)
|
||||
{
|
||||
if (IsCCInput(tx.vin[i].scriptSig)==0) return eval->Invalid("vin."+std::to_string(i)+" is CC for gatewaysclaim!");
|
||||
i++;
|
||||
@@ -1108,20 +1106,14 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
if ( AddNormalinputs(mtx,mypk,txfee,1) > 0 )
|
||||
if ((inputs=AddGatewaysInputs(cp, mtx, gatewayspk, bindtxid, amount, 60)) > 0)
|
||||
{
|
||||
if ((inputs=AddGatewaysInputs(cp, mtx, gatewayspk, bindtxid, amount, 60)) > 0)
|
||||
{
|
||||
if ( inputs > amount ) CCchange = (inputs - amount);
|
||||
mtx.vin.push_back(CTxIn(deposittxid,0,CScript()));
|
||||
mtx.vout.push_back(MakeCC1vout(EVAL_TOKENS,amount,destpub));
|
||||
if ( CCchange != 0 ) mtx.vout.push_back(MakeTokensCC1vout(EVAL_GATEWAYS,CCchange,gatewayspk));
|
||||
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysClaimOpRet('C',tokenid,bindtxid,refcoin,deposittxid,destpub,amount)));
|
||||
}
|
||||
if ( inputs > amount ) CCchange = (inputs - amount);
|
||||
mtx.vin.push_back(CTxIn(deposittxid,0,CScript()));
|
||||
mtx.vout.push_back(MakeCC1vout(EVAL_TOKENS,amount,destpub));
|
||||
if ( CCchange != 0 ) mtx.vout.push_back(MakeTokensCC1vout(EVAL_GATEWAYS,CCchange,gatewayspk));
|
||||
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysClaimOpRet('C',tokenid,bindtxid,refcoin,deposittxid,destpub,amount)));
|
||||
}
|
||||
CCerror = strprintf("cant find enough inputs or mismatched total");
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
|
||||
std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin,CPubKey withdrawpub,int64_t amount)
|
||||
|
||||
Reference in New Issue
Block a user