From 750446a019370acfc9b2f9ffdc8daf347fa5fbce Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 1 Dec 2018 03:16:26 -1100 Subject: [PATCH] Verify entropy tx is confirmed for dealer0 --- src/cc/dice.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 9c8438fd4..4f923d754 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1505,7 +1505,7 @@ std::string DiceBetFinish(uint8_t &funcid,uint256 &entropyused,int32_t &entropyv { if ( vin0txid == zeroid || vin0vout < 0 ) { - if ( AddNormalinputs(mtx,mypk,2*txfee,3) == 0 ) // must be a single vin!! + if ( AddNormalinputs2(mtx,2*txfee,3) == 0 ) // must be a single vin!! { CCerror = "no txfee inputs for win/lose"; fprintf(stderr,"%s\n", CCerror.c_str() ); @@ -1652,7 +1652,7 @@ static uint256 dealer0_fundingtxid; void *dealer0_loop(void *_arg) { char *planstr = (char *)_arg; - CTransaction tx; CPubKey mypk,dicepk; uint64_t entropyval; uint256 entropytxid; int32_t height,lastht,entropytxs,i,n,num; CScript fundingPubKey; struct CCcontract_info *cp,C; char coinaddr[64]; std::string res; int64_t minbet,maxbet,maxodds,timeoutblocks; uint64_t refsbits,txfee = 10000; + CTransaction tx,*entropytxs,entropytx; CPubKey mypk,dicepk; uint64_t entropyval; uint256 entropytxid,txid; int32_t height,lastht,entropytxs,i,n,m,num; CScript fundingPubKey; struct CCcontract_info *cp,C; char coinaddr[64]; std::string res; int64_t minbet,maxbet,maxodds,timeoutblocks; uint64_t refsbits,txfee = 10000; if ( (cp= Diceinit(fundingPubKey,dealer0_fundingtxid,&C,planstr,txfee,mypk,dicepk,refsbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 ) { fprintf(stderr,"error initializing dealer0_loop\n"); @@ -1660,6 +1660,7 @@ void *dealer0_loop(void *_arg) } fprintf(stderr,"dealer0 node running\n"); height = lastht = 0; + entropytx = (CTransaction *)calloc(sizeof(*entropytx),DICE_MINUTXOS); while ( 1 ) { while ( KOMODO_INSYNC == 0 || (height= KOMODO_INSYNC) == lastht ) @@ -1674,7 +1675,7 @@ void *dealer0_loop(void *_arg) n = sqrt(DICE_MINUTXOS - entropytxs); //if ( n > 10 ) // n = 10; - for (i=0; i 64 && is_hexstr((char *)res.c_str(),0) > 64 ) @@ -1686,10 +1687,30 @@ void *dealer0_loop(void *_arg) { fprintf(stderr,"ENTROPY %s: %d of %d, %d\n",tx.GetHash().GetHex().c_str(),i,n,DICE_MINUTXOS - entropytxs); RelayTransaction(tx); + entropytxs[m++] = tx; } else break; } else break; } else break; } + for (i=0; i