This commit is contained in:
blackjok3r
2018-10-29 16:30:07 +08:00
parent b888ef1af1
commit 95bb8b29f2

View File

@@ -545,21 +545,17 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx)
//vout.1: tag to owner address for entropy funds
preventCCvouts = 1;
CBlockIndex block;
int skipped = 0;
DiceAmounts(inputs,outputs,cp,eval,tx,sbits,fundingtxid);
if ( IsCCInput(tx.vin[1].scriptSig) == 0 || IsCCInput(tx.vin[2].scriptSig) == 0 )
return eval->Invalid("vin0 or vin1 normal vin for bet");
else if ( tx.vin[1].prevout.hash != tx.vin[2].prevout.hash )
return eval->Invalid("vin0 != vin1 prevout.hash for bet");
else if ( eval->GetTxUnconfirmed(tx.vin[1].prevout.hash,vinTx,hashBlock) == 0 ) {
int tries = 0;
while ( eval->GetTxUnconfirmed(tx.vin[1].prevout.hash,vinTx,hashBlock) == 0 ) {
tries++;
sleep(1);
char str[65],str2[65],str3[65];
fprintf(stderr, "txid.%s tx.%s hashBlock.%s\n",uint256_str(str,txid),uint256_str(str2,tx.vin[1].prevout.hash),uint256_str(str3,hashBlock));
if ( tries > 10 ) {
return eval->Invalid("always should find after 60s of looking vin.0, but didnt for wlt");
}
//return eval->Invalid("always should find looking vin.0, but didnt for wlt");
skipped = 1;
}
} else if (hashBlock.IsNull() || !eval->GetBlock(hashBlock, block))
return eval->Invalid(" TX not confirmed! always should find vin.0, but didnt for wlt");
@@ -583,6 +579,8 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx)
iswin = -1;
}
else
{
if ( skipped == 0)
{
//vout.0: funding CC change to entropy owner
//vout.2: normal output to bettor's address
@@ -606,6 +604,7 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx)
}
iswin = (funcid == 'W');
}
}
if ( iswin != 0 )
{
//char str[65],str2[65];