test
This commit is contained in:
11
src/komodo.h
11
src/komodo.h
@@ -178,6 +178,7 @@ const char *Notaries[64][2] =
|
|||||||
int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,NOTARIZED_HEIGHT;
|
int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,NOTARIZED_HEIGHT;
|
||||||
std::string NOTARY_PUBKEY;
|
std::string NOTARY_PUBKEY;
|
||||||
uint256 NOTARIZED_HASH;
|
uint256 NOTARIZED_HASH;
|
||||||
|
char *komodo_gettxout(bits256 hash,int32_t n);
|
||||||
|
|
||||||
int32_t komodo_blockindexcheck(CBlockIndex *pindex,uint32_t *nBitsp)
|
int32_t komodo_blockindexcheck(CBlockIndex *pindex,uint32_t *nBitsp)
|
||||||
{
|
{
|
||||||
@@ -208,10 +209,10 @@ int32_t komodo_blockindexcheck(CBlockIndex *pindex,uint32_t *nBitsp)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void komodo_connectblock(CBlockIndex *pindex,CBlock& block,int32_t numvins)
|
void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
||||||
{
|
{
|
||||||
char *scriptstr,*opreturnstr; uint32_t notarizedheight; uint8_t opret[256];
|
char *scriptstr,*opreturnstr; uint32_t notarizedheight; uint8_t opret[256];
|
||||||
int32_t i,j,k,opretlen,len,numvouts,height,txn_count; uint256 kmdtxid,btctxid;
|
int32_t i,j,k,opretlen,len,numvouts,numvins,height,txn_count; uint256 kmdtxid,btctxid;
|
||||||
// update voting results and official (height, notaries[])
|
// update voting results and official (height, notaries[])
|
||||||
if ( pindex != 0 )
|
if ( pindex != 0 )
|
||||||
{
|
{
|
||||||
@@ -219,6 +220,12 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block,int32_t numvins)
|
|||||||
txn_count = block.vtx.size();
|
txn_count = block.vtx.size();
|
||||||
for (i=0; i<txn_count; i++)
|
for (i=0; i<txn_count; i++)
|
||||||
{
|
{
|
||||||
|
numvins = block.vtx[i].vin.size();
|
||||||
|
for (j=0; j<numvins; j++)
|
||||||
|
{
|
||||||
|
if ( (scriptstr= komodo_gettxout(block.vtx[i].vin[j].prevout.hash,block.vtx[i].vin[j].prevout.n)) != 0 )
|
||||||
|
printf("ht.%d i.%d j.%d (%s)\n",height,i,j,scriptstr);
|
||||||
|
}
|
||||||
numvouts = block.vtx[i].vout.size();
|
numvouts = block.vtx[i].vout.size();
|
||||||
for (j=0; j<numvouts; j++)
|
for (j=0; j<numvouts; j++)
|
||||||
{
|
{
|
||||||
|
|||||||
14
src/main.cpp
14
src/main.cpp
@@ -2222,20 +2222,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
int64_t nTime4 = GetTimeMicros(); nTimeCallbacks += nTime4 - nTime3;
|
int64_t nTime4 = GetTimeMicros(); nTimeCallbacks += nTime4 - nTime3;
|
||||||
LogPrint("bench", " - Callbacks: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeCallbacks * 0.000001);
|
LogPrint("bench", " - Callbacks: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeCallbacks * 0.000001);
|
||||||
|
|
||||||
int32_t i,j,height,txn_count,numvins; char *scriptstr;
|
|
||||||
//FlushStateToDisk();
|
//FlushStateToDisk();
|
||||||
height = pindex->nHeight;
|
komodo_connectblock(pindex,*(CBlock *)&block);
|
||||||
txn_count = block.vtx.size();
|
|
||||||
for (i=0; i<txn_count; i++)
|
|
||||||
{
|
|
||||||
numvins = block.vtx[i].vin.size();
|
|
||||||
for (j=0; j<numvins; j++)
|
|
||||||
{
|
|
||||||
scriptstr = (char *)view.GetSpendFor(block.vtx[i].vin[j]).ToString().c_str();
|
|
||||||
printf("ht.%d txi.%d vini.%d of %d: (%s)\n",height,i,j,numvins,scriptstr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
komodo_connectblock(pindex,*(CBlock *)&block,numvins);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -460,6 +460,18 @@ Value gettxout(const Array& params, bool fHelp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *komodo_gettxout(bits256 hash,int32_t n)
|
||||||
|
{
|
||||||
|
CCoins coins; CBlockIndex *pindex;
|
||||||
|
if ( pcoinsTip->GetCoins(hash,coins) == 0 )
|
||||||
|
return(0);
|
||||||
|
if ( n < 0 || (unsigned int)n >= coins.vout.size() || coins.vout[n].IsNull() )
|
||||||
|
return(0);
|
||||||
|
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||||
|
pindex = it->second;
|
||||||
|
return(coins.vout[n].scriptPubKey.ToString().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
Value verifychain(const Array& params, bool fHelp)
|
Value verifychain(const Array& params, bool fHelp)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() > 2)
|
if (fHelp || params.size() > 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user