Skip coinable for normal inputs

This commit is contained in:
jl777
2018-08-01 06:40:14 -11:00
parent dcea6b0274
commit 5ce44e362e
2 changed files with 14 additions and 10 deletions

View File

@@ -203,7 +203,7 @@ uint64_t CCutxovalue(char *coinaddr,uint256 utxotxid,int32_t utxovout)
uint64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,uint64_t total,int32_t maxinputs)
{
int32_t vout,j,n = 0; uint64_t nValue,totalinputs = 0; uint256 txid; std::vector<COutput> vecOutputs;
int32_t vout,j,n = 0; uint64_t nValue,totalinputs = 0; uint256 txid,hashBlock; std::vector<COutput> vecOutputs;
#ifdef ENABLE_WALLET
const CKeyStore& keystore = *pwalletMain;
assert(pwalletMain != NULL);
@@ -220,12 +220,15 @@ uint64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,uint64_t total,in
break;
if ( j != mtx.vin.size() )
continue;
mtx.vin.push_back(CTxIn(txid,vout,CScript()));
nValue = out.tx->vout[out.i].nValue;
totalinputs += nValue;
n++;
if ( totalinputs >= total || n >= maxinputs )
break;
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.IsCoinBase() == 0 )
{
mtx.vin.push_back(CTxIn(txid,vout,CScript()));
nValue = out.tx->vout[out.i].nValue;
totalinputs += nValue;
n++;
if ( totalinputs >= total || n >= maxinputs )
break;
}
}
}
if ( totalinputs >= total )

View File

@@ -513,9 +513,10 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx)
case 'L':
case 'W':
case 'T':
//vin.0: betTx CC vout.0 entropy from bet
//vin.1: betTx CC vout.1 bet amount from bet
//vin.2+: funding CC vout.0 from 'F', 'E', 'W', 'L' or 'T'
//vin.0: normal input
//vin.1: betTx CC vout.0 entropy from bet
//vin.2: betTx CC vout.1 bet amount from bet
//vin.3+: funding CC vout.0 from 'F', 'E', 'W', 'L' or 'T'
//vout.1: tag to owner address for entropy funds
preventCCvouts = 1;
DiceAmounts(inputs,outputs,cp,eval,tx);