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) 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 #ifdef ENABLE_WALLET
const CKeyStore& keystore = *pwalletMain; const CKeyStore& keystore = *pwalletMain;
assert(pwalletMain != NULL); assert(pwalletMain != NULL);
@@ -220,12 +220,15 @@ uint64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,uint64_t total,in
break; break;
if ( j != mtx.vin.size() ) if ( j != mtx.vin.size() )
continue; continue;
mtx.vin.push_back(CTxIn(txid,vout,CScript())); if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.IsCoinBase() == 0 )
nValue = out.tx->vout[out.i].nValue; {
totalinputs += nValue; mtx.vin.push_back(CTxIn(txid,vout,CScript()));
n++; nValue = out.tx->vout[out.i].nValue;
if ( totalinputs >= total || n >= maxinputs ) totalinputs += nValue;
break; n++;
if ( totalinputs >= total || n >= maxinputs )
break;
}
} }
} }
if ( totalinputs >= total ) if ( totalinputs >= total )

View File

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