Fix oops
This commit is contained in:
@@ -15,6 +15,9 @@
|
|||||||
|
|
||||||
#include "CCassets.h"
|
#include "CCassets.h"
|
||||||
|
|
||||||
|
// need allassets
|
||||||
|
// find asset
|
||||||
|
|
||||||
int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint256 assetid,int64_t total,int32_t maxinputs)
|
int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint256 assetid,int64_t total,int32_t maxinputs)
|
||||||
{
|
{
|
||||||
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t j,vout,n = 0;
|
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t j,vout,n = 0;
|
||||||
|
|||||||
@@ -140,9 +140,9 @@ bool AssetsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx
|
|||||||
if ( (funcid= DecodeAssetOpRet(tx.vout[numvouts-1].scriptPubKey,assetid,assetid2,remaining_price,origpubkey)) == 0 )
|
if ( (funcid= DecodeAssetOpRet(tx.vout[numvouts-1].scriptPubKey,assetid,assetid2,remaining_price,origpubkey)) == 0 )
|
||||||
return eval->Invalid("Invalid opreturn payload");
|
return eval->Invalid("Invalid opreturn payload");
|
||||||
fprintf(stderr,"AssetValidate (%c)\n",funcid);
|
fprintf(stderr,"AssetValidate (%c)\n",funcid);
|
||||||
if ( cp->evalcode != 'o' && cp->evalcode != 'x' && eval->GetTxUnconfirmed(assetid,createTx,hashBlock) == 0 )
|
if ( funcid != 'o' && funcid != 'x' && eval->GetTxUnconfirmed(assetid,createTx,hashBlock) == 0 )
|
||||||
return eval->Invalid("cant find asset create txid");
|
return eval->Invalid("cant find asset create txid");
|
||||||
else if ( cp->evalcode != 'o' && cp->evalcode != 'x' && assetid2 != zero && eval->GetTxUnconfirmed(assetid2,createTx,hashBlock) == 0 )
|
else if ( funcid != 'o' && funcid != 'x' && assetid2 != zero && eval->GetTxUnconfirmed(assetid2,createTx,hashBlock) == 0 )
|
||||||
return eval->Invalid("cant find asset2 create txid");
|
return eval->Invalid("cant find asset2 create txid");
|
||||||
else if ( IsCCInput(tx.vin[0].scriptSig) != 0 )
|
else if ( IsCCInput(tx.vin[0].scriptSig) != 0 )
|
||||||
return eval->Invalid("illegal asset vin0");
|
return eval->Invalid("illegal asset vin0");
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ std::string RewardsUnlock(uint64_t txfee,char *planstr,uint256 fundingtxid,uint2
|
|||||||
if ( (inputs= AddRewardsInputs(cp,mtx,mypk,reward+amount+txfee,30)) > 0 )
|
if ( (inputs= AddRewardsInputs(cp,mtx,mypk,reward+amount+txfee,30)) > 0 )
|
||||||
{
|
{
|
||||||
if ( inputs >= (amount + reward + 2*txfee) )
|
if ( inputs >= (amount + reward + 2*txfee) )
|
||||||
CCchange = (inputs - amount - reward - txfee);
|
CCchange = (inputs - (amount + reward + txfee));
|
||||||
if ( CCchange != 0 )
|
if ( CCchange != 0 )
|
||||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CCchange,rewardspk));
|
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CCchange,rewardspk));
|
||||||
mtx.vout.push_back(CTxOut(amount+reward,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
mtx.vout.push_back(CTxOut(amount+reward,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
||||||
|
|||||||
Reference in New Issue
Block a user