diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index bd4c2950c..c14245577 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -94,7 +94,7 @@ WARNING: there is an attack vector that precludes betting any large amounts, it #include "../compat/endian.h" -#define MAX_ENTROPYUSED 3 +#define MAX_ENTROPYUSED 8192 static uint256 bettxids[MAX_ENTROPYUSED],entropytxids[MAX_ENTROPYUSED][2]; // change to hashtable @@ -1208,24 +1208,24 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx { txid = it->first.txhash; vout = (int32_t)it->first.index; - if ( GetTransaction(txid,betTx,hashBlock,false) != 0 && betTx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 ) + if ( GetTransaction(txid,betTx,hashBlock,false) != 0 && betTx.vout.size() >= 4 && betTx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 ) { - CSpentIndexKey key(txid, 0); - CSpentIndexValue value; - CSpentIndexKey key2(txid, 1); - CSpentIndexValue value2; - if ( GetSpentIndex(key,value) != 0 || GetSpentIndex(key2,value2) != 0 ) - { - fprintf(stderr,"status bettxid.%s already spent\n",txid.GetHex().c_str()); - continue; - } - if ( myIsutxo_spentinmempool(txid,0) != 0 || myIsutxo_spentinmempool(txid,1) != 0 ) - { - fprintf(stderr,"status bettxid.%s already spent in mempool\n",txid.GetHex().c_str()); - continue; - } if ( DecodeDiceOpRet(txid,betTx.vout[betTx.vout.size()-1].scriptPubKey,sbits,fundingtxid,hash,proof) == 'B' ) { + CSpentIndexKey key(txid, 0); + CSpentIndexValue value; + CSpentIndexKey key2(txid, 1); + CSpentIndexValue value2; + if ( GetSpentIndex(key,value) != 0 || GetSpentIndex(key2,value2) != 0 ) + { + fprintf(stderr,"status bettxid.%s already spent\n",txid.GetHex().c_str()); + continue; + } + if ( myIsutxo_spentinmempool(txid,0) != 0 || myIsutxo_spentinmempool(txid,1) != 0 ) + { + fprintf(stderr,"status bettxid.%s already spent in mempool\n",txid.GetHex().c_str()); + continue; + } res = DiceBetFinish(entropyused,&result,txfee,planstr,fundingtxid,txid,scriptPubKey == fundingPubKey); if ( result > 0 ) {