Baton for data from mempool
This commit is contained in:
@@ -235,6 +235,21 @@ int64_t OracleDatafee(CScript &scriptPubKey,uint256 oracletxid,CPubKey publisher
|
|||||||
return(datafee);
|
return(datafee);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint256 myIs_baton_spentinmempool(uint256 batontxid,int32_t batonvout)
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
|
||||||
|
{
|
||||||
|
const CTransaction &tx = e.GetTx();
|
||||||
|
if ( tx.vout.size() > 0 && tx.vin.size() > 1 && batontxid == tx.vin[1].prevout.hash && batonvout == tx.vin[1].prevout.n )
|
||||||
|
{
|
||||||
|
const uint256 &hash = tx.GetHash();
|
||||||
|
char str[65]; fprintf(stderr,"found baton spent in mempool %s\n",uint256_str(str,txid));
|
||||||
|
return(txid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(batontxid);
|
||||||
|
}
|
||||||
|
|
||||||
uint256 OracleBatonUtxo(uint64_t txfee,struct CCcontract_info *cp,uint256 reforacletxid,char *batonaddr,CPubKey publisher,std::vector <uint8_t> &dataarg)
|
uint256 OracleBatonUtxo(uint64_t txfee,struct CCcontract_info *cp,uint256 reforacletxid,char *batonaddr,CPubKey publisher,std::vector <uint8_t> &dataarg)
|
||||||
{
|
{
|
||||||
uint256 txid,oracletxid,hashBlock,btxid,batontxid = zeroid; int64_t dfee; int32_t dheight=0,vout,height,numvouts; CTransaction tx; CPubKey pk; uint8_t *ptr; std::vector<uint8_t> vopret,data;
|
uint256 txid,oracletxid,hashBlock,btxid,batontxid = zeroid; int64_t dfee; int32_t dheight=0,vout,height,numvouts; CTransaction tx; CPubKey pk; uint8_t *ptr; std::vector<uint8_t> vopret,data;
|
||||||
@@ -273,6 +288,8 @@ uint256 OracleBatonUtxo(uint64_t txfee,struct CCcontract_info *cp,uint256 refora
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while ( myIsutxo_spentinmempool(batontxid,1) != 0 )
|
||||||
|
batontxid = myIs_baton_spentinmempool(batontxid,1);
|
||||||
return(batontxid);
|
return(batontxid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,11 +301,11 @@ uint256 OraclesBatontxid(uint256 reforacletxid,CPubKey refpk)
|
|||||||
cp = CCinit(&C,EVAL_ORACLES);
|
cp = CCinit(&C,EVAL_ORACLES);
|
||||||
CCtxidaddr(markeraddr,reforacletxid);
|
CCtxidaddr(markeraddr,reforacletxid);
|
||||||
SetCCunspents(unspentOutputs,markeraddr);
|
SetCCunspents(unspentOutputs,markeraddr);
|
||||||
char str[67]; fprintf(stderr,"markeraddr.(%s) %s\n",markeraddr,pubkey33_str(str,(uint8_t *)&refpk));
|
//char str[67]; fprintf(stderr,"markeraddr.(%s) %s\n",markeraddr,pubkey33_str(str,(uint8_t *)&refpk));
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
fprintf(stderr,"check %s\n",uint256_str(str,txid));
|
//fprintf(stderr,"check %s\n",uint256_str(str,txid));
|
||||||
height = (int32_t)it->second.blockHeight;
|
height = (int32_t)it->second.blockHeight;
|
||||||
if ( myGetTransaction(txid,regtx,hash) != 0 )
|
if ( myGetTransaction(txid,regtx,hash) != 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ bool RewardsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t myIs_unlockedtx_inmempool(uint256 &txid,int32_t &vout,uint64_t refsbits,uint256 reffundingtxid,uint64_t needed)
|
static uint64_t myIs_unlockedtx_inmempool(uint256 &txid,int32_t &vout,uint64_t refsbits,uint256 reffundingtxid,uint64_t needed)
|
||||||
{
|
{
|
||||||
uint8_t funcid; uint64_t sbits,nValue; uint256 fundingtxid; char str[65];
|
uint8_t funcid; uint64_t sbits,nValue; uint256 fundingtxid; char str[65];
|
||||||
memset(&txid,0,sizeof(txid));
|
memset(&txid,0,sizeof(txid));
|
||||||
|
|||||||
Reference in New Issue
Block a user