added othertokenscond to FinalizeCCtx
This commit is contained in:
@@ -618,7 +618,7 @@ std::string FillBuyOffer(int64_t txfee,uint256 assetid,uint256 bidtxid,int64_t f
|
|||||||
|
|
||||||
//CPubKey unspendableTokensPk = GetUnspendable(cpTokens, NULL);
|
//CPubKey unspendableTokensPk = GetUnspendable(cpTokens, NULL);
|
||||||
uint8_t unspendableAssetsPrivkey[32];
|
uint8_t unspendableAssetsPrivkey[32];
|
||||||
cpTokens = CCinit(&assetsC, EVAL_ASSETS);
|
cpTokens = CCinit(&assetsC, EVAL_ASSETS); //???
|
||||||
CPubKey unspendableAssetsPk = GetUnspendable(cpAssets, unspendableAssetsPrivkey);
|
CPubKey unspendableAssetsPk = GetUnspendable(cpAssets, unspendableAssetsPrivkey);
|
||||||
|
|
||||||
mtx.vout.push_back(MakeCC1vout(EVAL_ASSETS, bidamount - paid_amount, unspendableAssetsPk)); // vout0 coins remainder
|
mtx.vout.push_back(MakeCC1vout(EVAL_ASSETS, bidamount - paid_amount, unspendableAssetsPk)); // vout0 coins remainder
|
||||||
@@ -742,6 +742,15 @@ std::string FillSell(int64_t txfee,uint256 assetid,uint256 assetid2,uint256 askt
|
|||||||
//mtx.vout.push_back(MakeCC1vout(EVAL_ASSETS, CCchange, mypk)); //vout.3 coins in Assets cc addr (swap not implemented)
|
//mtx.vout.push_back(MakeCC1vout(EVAL_ASSETS, CCchange, mypk)); //vout.3 coins in Assets cc addr (swap not implemented)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t unspendableAssetsPrivkey[32];
|
||||||
|
char unspendableAssetsAddr[64];
|
||||||
|
// init 'unspenable' privkey and pubkey
|
||||||
|
CPubKey unspendableAssetsPk = GetUnspendable(cpAssets, unspendableAssetsPrivkey);
|
||||||
|
GetCCaddress(cpAssets, unspendableAssetsAddr, unspendableAssetsPk);
|
||||||
|
|
||||||
|
// add additional unspendable addr from Assets:
|
||||||
|
CCaddr2set(cpAssets, EVAL_ASSETS, unspendableAssetsPk, unspendableAssetsPrivkey, unspendableAssetsAddr);
|
||||||
|
|
||||||
// vout verification pubkeys:
|
// vout verification pubkeys:
|
||||||
std::vector<CPubKey> voutTokenPubkeys;
|
std::vector<CPubKey> voutTokenPubkeys;
|
||||||
voutTokenPubkeys.push_back(mypk);
|
voutTokenPubkeys.push_back(mypk);
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
|||||||
CTransaction vintx; std::string hex; uint256 hashBlock; uint64_t mask=0,nmask=0,vinimask=0;
|
CTransaction vintx; std::string hex; uint256 hashBlock; uint64_t mask=0,nmask=0,vinimask=0;
|
||||||
int64_t utxovalues[CC_MAXVINS],change,normalinputs=0,totaloutputs=0,normaloutputs=0,totalinputs=0,normalvins=0,ccvins=0;
|
int64_t utxovalues[CC_MAXVINS],change,normalinputs=0,totaloutputs=0,normaloutputs=0,totalinputs=0,normalvins=0,ccvins=0;
|
||||||
int32_t i,utxovout,n,err = 0;
|
int32_t i,utxovout,n,err = 0;
|
||||||
char myaddr[64], destaddr[64], unspendable[64], mytokensaddr[64], mysingletokensaddr[64];
|
char myaddr[64], destaddr[64], unspendable[64], mytokensaddr[64], mysingletokensaddr[64], tokensunspendable[64];
|
||||||
uint8_t *privkey, myprivkey[32], unspendablepriv[32], *msg32 = 0;
|
uint8_t *privkey, myprivkey[32], unspendablepriv[32], *msg32 = 0;
|
||||||
CC *mycond=0, *othercond=0, *othercond2=0, *othercond3=0, *othercond1of2=NULL, *othercond1of2tokens = NULL, *cond, *mytokenscond = NULL, *mysingletokenscond = NULL;
|
CC *mycond=0, *othercond=0, *othercond2=0, *othercond3=0, *othercond1of2=NULL, *othercond1of2tokens = NULL, *cond, *mytokenscond = NULL, *mysingletokenscond = NULL, *othertokenscond = NULL;
|
||||||
CPubKey unspendablepk;
|
CPubKey unspendablepk;
|
||||||
struct CCcontract_info *cpTokens, tokensC;
|
struct CCcontract_info *cpTokens, tokensC;
|
||||||
|
|
||||||
@@ -74,9 +74,12 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
|||||||
GetCCaddress(cpTokens, mysingletokensaddr, mypk);
|
GetCCaddress(cpTokens, mysingletokensaddr, mypk);
|
||||||
mysingletokenscond = MakeCCcond1(EVAL_TOKENS, mypk);
|
mysingletokenscond = MakeCCcond1(EVAL_TOKENS, mypk);
|
||||||
|
|
||||||
unspendablepk = GetUnspendable(cp,unspendablepriv);
|
unspendablepk = GetUnspendable(cp, unspendablepriv);
|
||||||
GetCCaddress(cp,unspendable,unspendablepk);
|
GetCCaddress(cp, unspendable, unspendablepk);
|
||||||
othercond = MakeCCcond1(cp->evalcode,unspendablepk);
|
othercond = MakeCCcond1(cp->evalcode, unspendablepk);
|
||||||
|
|
||||||
|
GetTokensCCaddress(cp, tokensunspendable, unspendablepk);
|
||||||
|
othertokenscond = MakeTokensCCcond1(cp->evalcode, unspendablepk);
|
||||||
|
|
||||||
//Reorder vins so that for multiple normal vins all other except vin0 goes to the end
|
//Reorder vins so that for multiple normal vins all other except vin0 goes to the end
|
||||||
//This is a must to avoid hardfork change of validation in every CC, because there could be maximum one normal vin at the begining with current validation.
|
//This is a must to avoid hardfork change of validation in every CC, because there could be maximum one normal vin at the begining with current validation.
|
||||||
@@ -165,8 +168,14 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
|||||||
{
|
{
|
||||||
privkey = unspendablepriv;
|
privkey = unspendablepriv;
|
||||||
cond = othercond;
|
cond = othercond;
|
||||||
//fprintf(stderr,"FinalizeCCTx() unspendable CC addr.(%s)\n",unspendable);
|
//fprintf(stderr,"FinalizeCCTx() matched unspendable CC addr.(%s)\n",unspendable);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(destaddr, tokensunspendable) == 0)
|
||||||
|
{
|
||||||
|
privkey = unspendablepriv;
|
||||||
|
cond = othertokenscond;
|
||||||
|
fprintf(stderr,"FinalizeCCTx() matched tokensunspendable CC addr.(%s)\n",unspendable);
|
||||||
|
}
|
||||||
// check if this is the 2nd additional evalcode + 'unspendable' cc addr:
|
// check if this is the 2nd additional evalcode + 'unspendable' cc addr:
|
||||||
else if ( strcmp(destaddr,cp->unspendableaddr2) == 0)
|
else if ( strcmp(destaddr,cp->unspendableaddr2) == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user