This commit is contained in:
jl777
2018-11-06 01:51:06 -11:00
parent 6933a0c17b
commit 0e887331d3

View File

@@ -94,7 +94,7 @@ WARNING: there is an attack vector that precludes betting any large amounts, it
#include "../compat/endian.h" #include "../compat/endian.h"
#define MAX_ENTROPYUSED 3 #define MAX_ENTROPYUSED 8192
static uint256 bettxids[MAX_ENTROPYUSED],entropytxids[MAX_ENTROPYUSED][2]; // change to hashtable static uint256 bettxids[MAX_ENTROPYUSED],entropytxids[MAX_ENTROPYUSED][2]; // change to hashtable
@@ -1208,7 +1208,9 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx
{ {
txid = it->first.txhash; txid = it->first.txhash;
vout = (int32_t)it->first.index; 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 )
{
if ( DecodeDiceOpRet(txid,betTx.vout[betTx.vout.size()-1].scriptPubKey,sbits,fundingtxid,hash,proof) == 'B' )
{ {
CSpentIndexKey key(txid, 0); CSpentIndexKey key(txid, 0);
CSpentIndexValue value; CSpentIndexValue value;
@@ -1224,8 +1226,6 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx
fprintf(stderr,"status bettxid.%s already spent in mempool\n",txid.GetHex().c_str()); fprintf(stderr,"status bettxid.%s already spent in mempool\n",txid.GetHex().c_str());
continue; continue;
} }
if ( DecodeDiceOpRet(txid,betTx.vout[betTx.vout.size()-1].scriptPubKey,sbits,fundingtxid,hash,proof) == 'B' )
{
res = DiceBetFinish(entropyused,&result,txfee,planstr,fundingtxid,txid,scriptPubKey == fundingPubKey); res = DiceBetFinish(entropyused,&result,txfee,planstr,fundingtxid,txid,scriptPubKey == fundingPubKey);
if ( result > 0 ) if ( result > 0 )
{ {