diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 533e2c123..ceb9b409a 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -568,7 +568,7 @@ uint64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbi { if ( funcid == 'E' ) { - if ( GetTransaction(tx.vin[0].prevout.hash,vinTx,hashBlock,false) == 0 || vinTx.vout[tx.vin[0].prevout.n].scriptPubKey != fundingPubKey ) + if ( GetTransaction(tx.vin[0].prevout.hash,vinTx,hashBlock,false) == 0 || vinTx.vout[1].scriptPubKey != fundingPubKey || tx.vin[0].prevout.n != 0 ) { fprintf(stderr,"entropy vin[0] != fundingPubKey\n"); continue; @@ -577,7 +577,19 @@ uint64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbi entropytxid = txid; entropyval = tx.vout[0].nValue; first = 1; - } else fprintf(stderr,"(%c) fundingPubKey mismatch\n",funcid); + } + else + { + uint8_t *ptr0,*ptr1; int32_t i; + ptr0 = (uint8_t *)tx.vout[1].scriptPubKey.data(); + ptr1 = (uint8_t *)fundingPubKey.data(); + for (i=0; i fundsneeded+txfee ) CCchange += (inputs - (fundsneeded+txfee)); mtx.vout.push_back(MakeCC1vout(cp->evalcode,CCchange,dicepk)); - mtx.vout.push_back(CTxOut(txfee,entropyTx.vout[1].scriptPubKey)); + mtx.vout.push_back(CTxOut(txfee,fundingPubKey)); mtx.vout.push_back(CTxOut(odds * betTx.vout[1].nValue,betTx.vout[2].scriptPubKey)); } else @@ -860,7 +872,7 @@ std::string DiceWinLoseTimeout(int32_t *resultp,uint64_t txfee,char *planstr,uin { funcid = 'L'; mtx.vout.push_back(MakeCC1vout(cp->evalcode,betTx.vout[0].nValue + betTx.vout[1].nValue - txfee,dicepk)); - mtx.vout.push_back(CTxOut(txfee,entropyTx.vout[1].scriptPubKey)); + mtx.vout.push_back(CTxOut(txfee,fundingPubKey)); } if ( winlosetimeout != 0 ) hentropy = DiceHashEntropy(entropy,mtx.vin[0].prevout.hash);