This commit is contained in:
blackjok3r
2018-10-28 19:18:07 +08:00
parent b19a3d5217
commit cf4ddfaf5d
2 changed files with 3 additions and 11 deletions

View File

@@ -547,8 +547,10 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx)
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->GetTxConfirmedDICE(tx.vin[1].prevout.hash,vinTx,hashBlock) == 0 )
else if ( eval->GetTxUnconfirmed(tx.vin[1].prevout.hash,vinTx,hashBlock) == 0 ) {
if (hashBlock.IsNull() || !eval->GetBlock(hashBlock, block))
return eval->Invalid("always should find vin.0, but didnt for wlt");
}
else if ( vinTx.vout.size() < 3 || DecodeDiceOpRet(tx.vin[1].prevout.hash,vinTx.vout[vinTx.vout.size()-1].scriptPubKey,vinsbits,vinfundingtxid,vinhentropy,vinproof) != 'B' )
return eval->Invalid("not betTx for vin0/1 for wlt");
else if ( sbits != vinsbits || fundingtxid != vinfundingtxid )

View File

@@ -115,16 +115,6 @@ bool Eval::GetTxConfirmed(const uint256 &hash, CTransaction &txOut, CBlockIndex
return true;
}
bool Eval::GetTxConfirmedDICE(const uint256 &hash, CTransaction &txOut,uint256 &hashBlock) const
{
CBlockIndex block;
if (!GetTxUnconfirmed(hash, txOut, hashBlock))
return false;
if (hashBlock.IsNull() || !GetBlock(hashBlock, block))
return false;
return true;
}
unsigned int Eval::GetCurrentHeight() const
{
return chainActive.Height();