Fixes
This commit is contained in:
@@ -3276,9 +3276,9 @@ UniValue dilithium_spend(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
|
||||
} else return(cclib_error(result,"need to have exactly 2 params sendtxid, scriptPubKey"));
|
||||
}
|
||||
|
||||
int64_t dilithium_inputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,int64_t total,int32_t maxinputs,char *cmpaddr)
|
||||
int64_t dilithium_inputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint256 pubtxid,int64_t total,int32_t maxinputs,char *cmpaddr)
|
||||
{
|
||||
char coinaddr[64]; int64_t threshold,nValue,price,totalinputs = 0; uint256 tmptxid,txid,hashBlock; std::vector<uint8_t> origpubkey,tmpsig; CTransaction vintx; int32_t vout,numvouts,n = 0; std::vector<uint256> voutpubtxids;
|
||||
char coinaddr[64]; int64_t threshold,nValue,price,totalinputs = 0; uint256 checktxid,txid,hashBlock; std::vector<uint8_t> origpubkey,tmpsig; CTransaction vintx; int32_t vout,numvouts,n = 0; std::vector<uint256> voutpubtxids;
|
||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||
GetCCaddress(cp,coinaddr,pk);
|
||||
SetCCunspents(unspentOutputs,coinaddr);
|
||||
@@ -3294,7 +3294,7 @@ int64_t dilithium_inputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPu
|
||||
{
|
||||
if ( (nValue= IsCClibvout(cp,vintx,vout,cmpaddr)) > DILITHIUM_TXFEE && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
if ( dilithium_Qsendopretdecode(tmptxid,tmpsig,voutpubtxids,vintx.vout[numvouts-1].scriptPubKey) == 'Q' || dilithium_sendopretdecode(tmptxid,vintx.vout[numvouts-1].scriptPubKey) == 'x' )
|
||||
if ( (dilithium_Qsendopretdecode(checktxid,tmpsig,voutpubtxids,vintx.vout[numvouts-1].scriptPubKey) == 'Q' || dilithium_sendopretdecode(checktxid,vintx.vout[numvouts-1].scriptPubKey) == 'x') && desttxid == checktxid )
|
||||
{
|
||||
if ( total != 0 && maxinputs != 0 )
|
||||
mtx.vin.push_back(CTxIn(txid,vout,CScript()));
|
||||
@@ -3358,7 +3358,7 @@ UniValue dilithium_Qsend(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
|
||||
}
|
||||
outputsum += amount;
|
||||
}
|
||||
if ( (inputsum= dilithium_inputs(cp,mtx,mypk,outputsum+txfee,64,myCCaddr)) >= outputsum+txfee )
|
||||
if ( (inputsum= dilithium_inputs(cp,mtx,mypk,mypubtxid,outputsum+txfee,64,myCCaddr)) >= outputsum+txfee )
|
||||
{
|
||||
change = (inputsum - outputsum - txfee);
|
||||
if ( change >= txfee )
|
||||
|
||||
@@ -593,16 +593,19 @@ int32_t rogue_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametx
|
||||
numplayers = openslots = 0;
|
||||
if ( komodo_nextheight() <= gameht+ROGUE_MAXKEYSTROKESGAP )
|
||||
registration_open = 1;
|
||||
fprintf(stderr,"players alive\n");
|
||||
for (i=0; i<maxplayers; i++)
|
||||
{
|
||||
fprintf(stderr,"players alive %d\n",i);
|
||||
if ( CCgettxout(gametxid,1+i,1,0) < 0 )
|
||||
{
|
||||
numplayers++;
|
||||
fprintf(stderr,"players alive %d spent baton\n",i);
|
||||
if ( CCgettxout(gametxid,1+maxplayers+i,1,0) == txfee )
|
||||
{
|
||||
txid = gametxid;
|
||||
vout = 1+i;
|
||||
//fprintf(stderr,"scan forward active.%s spenttxid.%s\n",gametxid.GetHex().c_str(),txid.GetHex().c_str());
|
||||
fprintf(stderr,"rogue_playersalive scan forward active.%s spenttxid.%s\n",gametxid.GetHex().c_str(),txid.GetHex().c_str());
|
||||
n = 0;
|
||||
while ( CCgettxout(txid,vout,1,0) < 0 )
|
||||
{
|
||||
@@ -617,14 +620,16 @@ int32_t rogue_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametx
|
||||
}
|
||||
txid = spenttxid;
|
||||
vout = 0;
|
||||
//fprintf(stderr,"n.%d next txid.%s/v%d\n",n,txid.GetHex().c_str(),spentvini);
|
||||
fprintf(stderr,"n.%d next txid.%s/v%d\n",n,txid.GetHex().c_str(),spentvini);
|
||||
if ( spentvini != 0 )
|
||||
break;
|
||||
if ( n++ > ROGUE_MAXITERATIONS )
|
||||
break;
|
||||
}
|
||||
fprintf(stderr,"out of while\n");
|
||||
if ( txid != zeroid )
|
||||
{
|
||||
fprintf(stderr,"get height of %s\n",txid.GetHex().c_str());
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && (pindex= komodo_blockindex(hashBlock)) != 0 )
|
||||
{
|
||||
if ( pindex->GetHeight() <= gameht+ROGUE_MAXKEYSTROKESGAP )
|
||||
|
||||
Reference in New Issue
Block a user