From 6933a0c17b5a19c9c6bb6c36212e5764b14cbdde Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 6 Nov 2018 01:30:19 -1100 Subject: [PATCH] Test --- src/cc/dice.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index c328c552b..bd4c2950c 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1210,6 +1210,20 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx vout = (int32_t)it->first.index; if ( GetTransaction(txid,betTx,hashBlock,false) != 0 && 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' ) { res = DiceBetFinish(entropyused,&result,txfee,planstr,fundingtxid,txid,scriptPubKey == fundingPubKey); @@ -1217,10 +1231,7 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx { mySenddicetransaction(res,entropyused,txid); n++; - } else - { - error = res; - } + } else error = res; } } }