@@ -440,17 +440,6 @@ bool DiceVerifyTimeout(CTransaction &betTx,int32_t timeoutblocks)
|
|||||||
return(numblocks >= timeoutblocks);
|
return(numblocks >= timeoutblocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetBlock(uint256 hash, CBlockIndex& blockIdx)
|
|
||||||
{
|
|
||||||
auto r = mapBlockIndex.find(hash);
|
|
||||||
if (r != mapBlockIndex.end()) {
|
|
||||||
blockIdx = *r->second;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
fprintf(stderr, "CC Eval Error: Can't get block from index\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx)
|
bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx)
|
||||||
{
|
{
|
||||||
uint256 txid,fundingtxid,vinfundingtxid,vinhentropy,vinproof,hashBlock,hash,proof,entropy; int64_t minbet,maxbet,maxodds,timeoutblocks,odds,winnings; uint64_t vinsbits,sbits,amount,inputs,outputs,txfee=10000; int32_t numvins,numvouts,preventCCvins,preventCCvouts,i,iswin; uint8_t funcid; CScript fundingPubKey; CTransaction fundingTx,vinTx,vinofvinTx; char CCaddr[64];
|
uint256 txid,fundingtxid,vinfundingtxid,vinhentropy,vinproof,hashBlock,hash,proof,entropy; int64_t minbet,maxbet,maxodds,timeoutblocks,odds,winnings; uint64_t vinsbits,sbits,amount,inputs,outputs,txfee=10000; int32_t numvins,numvouts,preventCCvins,preventCCvouts,i,iswin; uint8_t funcid; CScript fundingPubKey; CTransaction fundingTx,vinTx,vinofvinTx; char CCaddr[64];
|
||||||
@@ -559,7 +548,8 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx)
|
|||||||
else if ( tx.vin[1].prevout.hash != tx.vin[2].prevout.hash )
|
else if ( tx.vin[1].prevout.hash != tx.vin[2].prevout.hash )
|
||||||
return eval->Invalid("vin0 != vin1 prevout.hash for bet");
|
return eval->Invalid("vin0 != vin1 prevout.hash for bet");
|
||||||
else if ( eval->GetTxUnconfirmed(tx.vin[1].prevout.hash,vinTx,hashBlock) == 0 ) {
|
else if ( eval->GetTxUnconfirmed(tx.vin[1].prevout.hash,vinTx,hashBlock) == 0 ) {
|
||||||
if (hashBlock.IsNull() || !GetBlock(hashBlock, block))
|
CBlockIndex block;
|
||||||
|
if (hashBlock.IsNull() || !eval->GetBlock(hashBlock, block))
|
||||||
return eval->Invalid("always should find vin.0, but didnt for wlt");
|
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' )
|
else if ( vinTx.vout.size() < 3 || DecodeDiceOpRet(tx.vin[1].prevout.hash,vinTx.vout[vinTx.vout.size()-1].scriptPubKey,vinsbits,vinfundingtxid,vinhentropy,vinproof) != 'B' )
|
||||||
@@ -1104,9 +1094,7 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*resultp = -1;
|
*resultp = -1;
|
||||||
CCerror = "couldnt find bettx or entropytx";
|
return("couldnt find bettx or entropytx");
|
||||||
fprintf(stderr,"%s\n", CCerror.c_str() );
|
|
||||||
return("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid,std::string &error)
|
double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid,std::string &error)
|
||||||
@@ -1137,6 +1125,9 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx
|
|||||||
{
|
{
|
||||||
mySendrawtransaction(res);
|
mySendrawtransaction(res);
|
||||||
n++;
|
n++;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
error = res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,11 +76,11 @@ bool Eval::Dispatch(const CC *cond, const CTransaction &txTo, unsigned int nIn)
|
|||||||
case EVAL_IMPORTPAYOUT:
|
case EVAL_IMPORTPAYOUT:
|
||||||
return ImportPayout(vparams, txTo, nIn);
|
return ImportPayout(vparams, txTo, nIn);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVAL_IMPORTCOIN:
|
case EVAL_IMPORTCOIN:
|
||||||
return ImportCoin(vparams, txTo, nIn);
|
return ImportCoin(vparams, txTo, nIn);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return(ProcessCC(cp,this, vparams, txTo, nIn));
|
return(ProcessCC(cp,this, vparams, txTo, nIn));
|
||||||
break;
|
break;
|
||||||
@@ -115,7 +115,6 @@ bool Eval::GetTxConfirmed(const uint256 &hash, CTransaction &txOut, CBlockIndex
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int Eval::GetCurrentHeight() const
|
unsigned int Eval::GetCurrentHeight() const
|
||||||
{
|
{
|
||||||
return chainActive.Height();
|
return chainActive.Height();
|
||||||
|
|||||||
Reference in New Issue
Block a user