Iterate relay until in mempool
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "CCdice.h"
|
#include "CCdice.h"
|
||||||
|
|
||||||
// timeout, validate, verify win/loss can be used for entropy
|
// timeout
|
||||||
|
|
||||||
/*
|
/*
|
||||||
in order to implement a dice game, we need a source of entropy, reasonably fast completion time and a way to manage the utxos.
|
in order to implement a dice game, we need a source of entropy, reasonably fast completion time and a way to manage the utxos.
|
||||||
@@ -122,13 +122,20 @@ void *dicefinish(void *_ptr)
|
|||||||
res = DiceWinLoseTimeout(&result,0,name,ptr->fundingtxid,ptr->bettxid,ptr->iswin);
|
res = DiceWinLoseTimeout(&result,0,name,ptr->fundingtxid,ptr->bettxid,ptr->iswin);
|
||||||
if ( result != 0 && res.empty() == 0 && res.size() > 64 && is_hexstr((char *)res.c_str(),0) > 64 )
|
if ( result != 0 && res.empty() == 0 && res.size() > 64 && is_hexstr((char *)res.c_str(),0) > 64 )
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
//LOCK(cs_main);
|
||||||
if ( DecodeHexTx(tx,res) != 0 )
|
if ( DecodeHexTx(tx,res) != 0 )
|
||||||
{
|
{
|
||||||
txid = tx.GetHash();
|
txid = tx.GetHash();
|
||||||
myAddtomempool(tx);
|
|
||||||
RelayTransaction(tx);
|
|
||||||
fprintf(stderr,"%s\nresult.(%s)\n",res.c_str(),uint256_str(str,txid));
|
fprintf(stderr,"%s\nresult.(%s)\n",res.c_str(),uint256_str(str,txid));
|
||||||
|
for (i=0; i<10; i++)
|
||||||
|
{
|
||||||
|
if ( myAddtomempool(tx) == 0 )
|
||||||
|
{
|
||||||
|
RelayTransaction(tx);
|
||||||
|
fprintf(stderr,"Relay transaction\n");
|
||||||
|
sleep(1);
|
||||||
|
} else break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -645,7 +652,7 @@ uint64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbi
|
|||||||
fprintf(stderr," (%c) entropy vin.%d fundingPubKey mismatch %s\n",funcid,tx.vin[0].prevout.n,uint256_str(str,tx.vin[0].prevout.hash));
|
fprintf(stderr," (%c) entropy vin.%d fundingPubKey mismatch %s\n",funcid,tx.vin[0].prevout.n,uint256_str(str,tx.vin[0].prevout.hash));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else fprintf(stderr,"not E or is funding\n");
|
} //else fprintf(stderr,"not E or is funding\n");
|
||||||
entropytxid = txid;
|
entropytxid = txid;
|
||||||
entropyval = tx.vout[0].nValue;
|
entropyval = tx.vout[0].nValue;
|
||||||
first = 1;
|
first = 1;
|
||||||
|
|||||||
@@ -1608,7 +1608,7 @@ bool myAddtomempool(CTransaction &tx)
|
|||||||
CValidationState state; CTransaction Ltx; bool fMissingInputs,fOverrideFees = false;
|
CValidationState state; CTransaction Ltx; bool fMissingInputs,fOverrideFees = false;
|
||||||
if ( mempool.lookup(tx.GetHash(),Ltx) == 0 )
|
if ( mempool.lookup(tx.GetHash(),Ltx) == 0 )
|
||||||
return(AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees));
|
return(AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees));
|
||||||
else return(false);
|
else return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock)
|
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock)
|
||||||
|
|||||||
Reference in New Issue
Block a user