NSPV_MEMPOOL_CCEVALCODE
Searches mempool for CC evalcode and fancied
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
// todo:
|
||||
// spentinfo via CC
|
||||
|
||||
// headers "sync" make sure it connects to prior blocks to notarization. use getinfo hdrht to get missing hdrs
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#define NSPV_MEMPOOL_ADDRESS 1
|
||||
#define NSPV_MEMPOOL_ISSPENT 2
|
||||
#define NSPV_MEMPOOL_INMEMPOOL 3
|
||||
#define NSPV_MEMPOOL_CCEVALCODE 4
|
||||
|
||||
int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int32_t height,CTransaction &tx,int64_t extradata,uint32_t tiptime,int64_t &rewardsum);
|
||||
UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis);
|
||||
|
||||
@@ -243,10 +243,16 @@ int32_t NSPV_getaddresstxids(struct NSPV_txidsresp *ptr,char *coinaddr,bool isCC
|
||||
|
||||
int32_t NSPV_mempoolfuncs(int32_t *vindexp,std::vector<uint256> &txids,char *coinaddr,bool isCC,uint8_t funcid,uint256 txid,int32_t vout)
|
||||
{
|
||||
int32_t num = 0,vini = 0,vouti = 0; char destaddr[64];
|
||||
int32_t num = 0,vini = 0,vouti = 0; uint8_t evalcode,funcid=0; std::vector<uint8_t> vopret; char destaddr[64];
|
||||
*vindexp = -1;
|
||||
if ( mempool.size() == 0 )
|
||||
return(0);
|
||||
if ( funcid == NSPV_MEMPOOL_CCEVALCODE )
|
||||
{
|
||||
isCC = true;
|
||||
evalcode = vout & 0xff;
|
||||
funcid = (vout >> 8) & 0xff;
|
||||
}
|
||||
LOCK(mempool.cs);
|
||||
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
|
||||
{
|
||||
@@ -267,6 +273,22 @@ int32_t NSPV_mempoolfuncs(int32_t *vindexp,std::vector<uint256> &txids,char *coi
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if ( funcid == NSPV_MEMPOOL_CCEVALCODE )
|
||||
{
|
||||
if ( tx.vout.size() > 1 )
|
||||
{
|
||||
scriptPubKey = tx.vout[tx.vout.size()-1].scriptPubKey;
|
||||
if ( GetOpReturnData(scriptPubKey,vopret) != 0 )
|
||||
{
|
||||
if ( vpopret[0] == evalcode && vpopret[1] == funcid )
|
||||
{
|
||||
txids.push_back(hash);
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ( funcid == NSPV_MEMPOOL_ISSPENT )
|
||||
{
|
||||
BOOST_FOREACH(const CTxIn &txin,tx.vin)
|
||||
@@ -303,7 +325,7 @@ int32_t NSPV_mempoolfuncs(int32_t *vindexp,std::vector<uint256> &txids,char *coi
|
||||
return(num);
|
||||
}
|
||||
|
||||
int32_t NSPV_mempooltxids(struct NSPV_mempoolresp *ptr,char *coinaddr,bool isCC,uint8_t funcid,uint256 txid,int32_t vout)
|
||||
int32_t NSPV_mempooltxids(struct NSPV_mempoolresp *ptr,char *coinaddr,uint8_t isCC,uint8_t funcid,uint256 txid,int32_t vout)
|
||||
{
|
||||
std::vector<uint256> txids; uint256 tmp,tmpdest; int32_t i,len = 0;
|
||||
ptr->nodeheight = chainActive.LastTip()->GetHeight();
|
||||
|
||||
@@ -718,6 +718,13 @@ bool NSPV_inmempool(uint256 txid)
|
||||
else return(false);
|
||||
}
|
||||
|
||||
bool NSPV_evalcode_inmempool(uint8_t evalcode,uint8_t funcid)
|
||||
{
|
||||
int32_t vout;
|
||||
vout = ((uint32_t)funcid << 8) | evalcode;
|
||||
NSPV_mempooltxids((char *)"",1,NSPV_MEMPOOL_CCEVALCODE,zeroid,vout);
|
||||
}
|
||||
|
||||
UniValue NSPV_notarizations(int32_t reqheight)
|
||||
{
|
||||
uint8_t msg[64]; int32_t i,iter,len = 0; struct NSPV_ntzsresp N,*ptr;
|
||||
|
||||
Reference in New Issue
Block a user