diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 7af6eba0e..b7d952585 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -132,6 +132,18 @@ int32_t _dicehash_find(uint256 bettxid) return(0); } +int32_t _dicehash_clear(uint256 bettxid) +{ + int32_t i; + for (i=0; ibettxid); + pthread_mutex_unlock(&DICE_MUTEX); + DL_DELETE(DICEFINISH_LIST,ptr); + free(ptr); +} + void *dicefinish(void *_ptr) { std::vector mypk; struct CCcontract_info *cp,C; char name[32],coinaddr[64],CCaddr[64]; std::string res; int32_t newht,newblock,numblocks,lastheight=0,vin0_needed,n,m,num,iter,result; struct dicefinish_info *ptr,*tmp; struct dicefinish_utxo *utxos; uint256 hashBlock; CTransaction betTx; @@ -313,8 +334,7 @@ void *dicefinish(void *_ptr) if ( ptr->revealed != 0 && time(NULL) > ptr->revealed+3600 ) { fprintf(stderr,"purge %s\n",ptr->bettxid.GetHex().c_str()); - DL_DELETE(DICEFINISH_LIST,ptr); - free(ptr); + dicefinish_delete(ptr); continue; } if ( ptr->bettxid_ready == 0 ) @@ -327,8 +347,7 @@ void *dicefinish(void *_ptr) else if ( myGetTransaction(ptr->bettxid,betTx,hashBlock) == 0 ) { fprintf(stderr,"ORPHANED bettxid.%s\n",ptr->bettxid.GetHex().c_str()); - DL_DELETE(DICEFINISH_LIST,ptr); - free(ptr); + dicefinish_delete(ptr); continue; } if ( ptr->bettxid_ready != 0 && ptr->iswin == iter ) @@ -358,8 +377,7 @@ void *dicefinish(void *_ptr) if ( ptr->revealed != 0 && time(NULL) > ptr->revealed+3600 ) { fprintf(stderr,"purge2 %s\n",ptr->bettxid.GetHex().c_str()); - DL_DELETE(DICEFINISH_LIST,ptr); - free(ptr); + dicefinish_delete(ptr); continue; } if ( ptr->txid != zeroid )