Test
This commit is contained in:
@@ -72,7 +72,7 @@ struct CCcontract_info
|
|||||||
CPubKey unspendablepk2;
|
CPubKey unspendablepk2;
|
||||||
bool (*validate)(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx);
|
bool (*validate)(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx);
|
||||||
bool (*ismyvin)(CScript const& scriptSig);
|
bool (*ismyvin)(CScript const& scriptSig);
|
||||||
uint8_t evalcode,didinit;
|
uint8_t evalcode,evalcode2,didinit;
|
||||||
};
|
};
|
||||||
struct CCcontract_info *CCinit(struct CCcontract_info *cp,uint8_t evalcode);
|
struct CCcontract_info *CCinit(struct CCcontract_info *cp,uint8_t evalcode);
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
|||||||
//fprintf(stderr,"matched %s unspendable2!\n",cp->unspendableaddr2);
|
//fprintf(stderr,"matched %s unspendable2!\n",cp->unspendableaddr2);
|
||||||
privkey = cp->unspendablepriv2;
|
privkey = cp->unspendablepriv2;
|
||||||
if ( othercond2 == 0 )
|
if ( othercond2 == 0 )
|
||||||
othercond2 = MakeCCcond1(cp->evalcode,cp->unspendablepk2);
|
othercond2 = MakeCCcond1(cp->evalcode2,cp->unspendablepk2);
|
||||||
cond = othercond2;
|
cond = othercond2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -554,12 +554,13 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui
|
|||||||
CMutableTransaction mtx; CTransaction tx; CPubKey mypk,gatewayspk; struct CCcontract_info *cp,C,*assetscp,C2; uint8_t M,N,taddr,prefix,prefix2; std::string coin; std::vector<CPubKey> msigpubkeys; int64_t totalsupply,depositamount,inputs,CCchange=0; int32_t numvouts; uint256 hashBlock,assetid,oracletxid; char str[65],depositaddr[64];
|
CMutableTransaction mtx; CTransaction tx; CPubKey mypk,gatewayspk; struct CCcontract_info *cp,C,*assetscp,C2; uint8_t M,N,taddr,prefix,prefix2; std::string coin; std::vector<CPubKey> msigpubkeys; int64_t totalsupply,depositamount,inputs,CCchange=0; int32_t numvouts; uint256 hashBlock,assetid,oracletxid; char str[65],depositaddr[64];
|
||||||
cp = CCinit(&C,EVAL_GATEWAYS);
|
cp = CCinit(&C,EVAL_GATEWAYS);
|
||||||
assetscp = CCinit(&C2,EVAL_ASSETS);
|
assetscp = CCinit(&C2,EVAL_ASSETS);
|
||||||
memcpy(assetscp->unspendablepriv2,cp->CCpriv,32);
|
|
||||||
if ( txfee == 0 )
|
if ( txfee == 0 )
|
||||||
txfee = 10000;
|
txfee = 10000;
|
||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
gatewayspk = GetUnspendable(cp,0);
|
gatewayspk = GetUnspendable(cp,0);
|
||||||
_GetCCaddress(assetscp->unspendableaddr2,EVAL_ASSETS,gatewayspk);
|
_GetCCaddress(cp->unspendableaddr2,EVAL_ASSETS,gatewayspk);
|
||||||
|
memcpy(cp->unspendablepriv2,cp->CCpriv,32);
|
||||||
|
cp->evalcode2 = EVAL_ASSETS;
|
||||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"cant find bindtxid %s\n",uint256_str(str,bindtxid));
|
fprintf(stderr,"cant find bindtxid %s\n",uint256_str(str,bindtxid));
|
||||||
@@ -582,7 +583,7 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui
|
|||||||
}
|
}
|
||||||
if ( AddNormalinputs(mtx,mypk,txfee,1) > 0 )
|
if ( AddNormalinputs(mtx,mypk,txfee,1) > 0 )
|
||||||
{
|
{
|
||||||
if ( (inputs= AddAssetInputs(assetscp,mtx,gatewayspk,assetid,amount,60)) > 0 )
|
if ( (inputs= AddAssetInputs(cp,mtx,gatewayspk,assetid,amount,60)) > 0 )
|
||||||
{
|
{
|
||||||
if ( inputs > amount )
|
if ( inputs > amount )
|
||||||
CCchange = (inputs - amount);
|
CCchange = (inputs - amount);
|
||||||
@@ -590,7 +591,7 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui
|
|||||||
mtx.vout.push_back(MakeCC1vout(EVAL_ASSETS,amount,mypk));
|
mtx.vout.push_back(MakeCC1vout(EVAL_ASSETS,amount,mypk));
|
||||||
if ( CCchange != 0 )
|
if ( CCchange != 0 )
|
||||||
mtx.vout.push_back(MakeCC1vout(EVAL_ASSETS,CCchange,gatewayspk));
|
mtx.vout.push_back(MakeCC1vout(EVAL_ASSETS,CCchange,gatewayspk));
|
||||||
return(FinalizeCCTx(0,assetscp,mtx,mypk,txfee,EncodeAssetOpRet('t',assetid,zeroid,0,Mypubkey())));
|
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeAssetOpRet('t',assetid,zeroid,0,Mypubkey())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(stderr,"cant find enough inputs or mismatched total\n");
|
fprintf(stderr,"cant find enough inputs or mismatched total\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user