Test
This commit is contained in:
@@ -41,12 +41,13 @@ bool SignTx(CMutableTransaction &mtx,int32_t vini,uint64_t utxovalue,const CScri
|
|||||||
std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey mypk,uint64_t txfee,CScript opret)
|
std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey mypk,uint64_t txfee,CScript opret)
|
||||||
{
|
{
|
||||||
auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus());
|
auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus());
|
||||||
CTransaction vintx; std::string hex; uint256 hashBlock; uint64_t mask=0,nmask=0,vinimask=0,utxovalues[64],change,totaloutputs=0,totalinputs=0; int32_t i,utxovout,n,err = 0; char myaddr[64],destaddr[64],unspendable[64]; uint8_t *privkey,myprivkey[32],unspendablepriv[32],*msg32 = 0; CC *mycond=0,*othercond=0,*cond; CPubKey unspendablepk;
|
CTransaction vintx; std::string hex; uint256 hashBlock; uint64_t mask=0,nmask=0,vinimask=0,utxovalues[64],change,totaloutputs=0,normaloutputs=0,totalinputs=0; int32_t i,utxovout,n,err = 0; char myaddr[64],destaddr[64],unspendable[64]; uint8_t *privkey,myprivkey[32],unspendablepriv[32],*msg32 = 0; CC *mycond=0,*othercond=0,*cond; CPubKey unspendablepk;
|
||||||
n = mtx.vout.size();
|
n = mtx.vout.size();
|
||||||
for (i=0; i<n; i++)
|
for (i=0; i<n; i++)
|
||||||
{
|
{
|
||||||
//if ( mtx.vout[i].scriptPubKey.IsPayToCryptoCondition() == 0 )
|
if ( mtx.vout[i].scriptPubKey.IsPayToCryptoCondition() == 0 )
|
||||||
totaloutputs += mtx.vout[i].nValue;
|
normaloutputs += mtx.vout[i].nValue;
|
||||||
|
totaloutputs += mtx.vout[i].nValue;
|
||||||
}
|
}
|
||||||
if ( (n= mtx.vin.size()) > 64 )
|
if ( (n= mtx.vin.size()) > 64 )
|
||||||
{
|
{
|
||||||
@@ -82,9 +83,9 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
|||||||
nmask = (1LL << n) - 1;
|
nmask = (1LL << n) - 1;
|
||||||
if ( (mask & nmask) != (CCmask & nmask) )
|
if ( (mask & nmask) != (CCmask & nmask) )
|
||||||
fprintf(stderr,"mask.%llx vs CCmask.%llx %llx %llx %llx\n",(long long)(mask & nmask),(long long)(CCmask & nmask),(long long)mask,(long long)CCmask,(long long)nmask);
|
fprintf(stderr,"mask.%llx vs CCmask.%llx %llx %llx %llx\n",(long long)(mask & nmask),(long long)(CCmask & nmask),(long long)mask,(long long)CCmask,(long long)nmask);
|
||||||
if ( totalinputs >= totaloutputs+2*txfee )
|
if ( totalinputs >= normaloutputs+2*txfee )
|
||||||
{
|
{
|
||||||
change = totalinputs - (totaloutputs+txfee);
|
change = totalinputs - (normaloutputs+txfee);
|
||||||
mtx.vout.push_back(CTxOut(change,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
mtx.vout.push_back(CTxOut(change,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
||||||
}
|
}
|
||||||
if ( opret.size() > 0 )
|
if ( opret.size() > 0 )
|
||||||
|
|||||||
Reference in New Issue
Block a user