test
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
|
||||
int32_t gettxout_scriptPubKey(uint8_t *scriptPubkey,int32_t maxsize,uint256 txid,int32_t n);
|
||||
void komodo_event_rewind(struct komodo_state *sp,char *symbol,int32_t height);
|
||||
void komodo_connectblock(CBlockIndex *pindex,CBlock& block);
|
||||
|
||||
#include "komodo_structs.h"
|
||||
#include "komodo_globals.h"
|
||||
|
||||
@@ -441,6 +441,23 @@ void komodo_block2pubkey33(uint8_t *pubkey33,CBlock& block)
|
||||
else memset(pubkey33,0,33);
|
||||
}
|
||||
|
||||
int32_t komodo_blockload(CBlock& block,cBlockIndex *pindex)
|
||||
{
|
||||
block.SetNull();
|
||||
// Open history file to read
|
||||
CAutoFile filein(OpenBlockFile(pindex->GetBlockPos(),true),SER_DISK,CLIENT_VERSION);
|
||||
if (filein.IsNull())
|
||||
return(-1);
|
||||
// Read block
|
||||
try { filein >> block; }
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
fprintf(stderr,"readblockfromdisk err B\n");
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
|
||||
{
|
||||
CBlock block;
|
||||
@@ -448,18 +465,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
|
||||
memset(pubkey33,0,33);
|
||||
if ( pindex != 0 )
|
||||
{
|
||||
block.SetNull();
|
||||
// Open history file to read
|
||||
CAutoFile filein(OpenBlockFile(pindex->GetBlockPos(),true),SER_DISK,CLIENT_VERSION);
|
||||
if (filein.IsNull())
|
||||
return;
|
||||
// Read block
|
||||
try { filein >> block; }
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
fprintf(stderr,"readblockfromdisk err B\n");
|
||||
return;
|
||||
}
|
||||
komodo_blockload(block,pindex);
|
||||
komodo_block2pubkey33(pubkey33,block);
|
||||
}
|
||||
else
|
||||
@@ -469,6 +475,13 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
|
||||
}
|
||||
}
|
||||
|
||||
void komodo_connectpindex(CBlockIndex *pindex)
|
||||
{
|
||||
CBlock block;
|
||||
komodo_blockload(block,pindex);
|
||||
komodo_connectblock(pindex,block);
|
||||
}
|
||||
|
||||
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height);
|
||||
|
||||
int8_t komodo_minerid(int32_t height)
|
||||
|
||||
12
src/main.cpp
12
src/main.cpp
@@ -2324,7 +2324,17 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||
|
||||
//FlushStateToDisk();
|
||||
komodo_connectblock(pindex,*(CBlock *)&block);
|
||||
|
||||
{
|
||||
static int32_t didinit;
|
||||
if ( didinit == 0 )
|
||||
{
|
||||
if ( (pindex= chainActive[73673]) != 0 )
|
||||
{
|
||||
komodo_connectpindex(pindex);
|
||||
}
|
||||
didiint = 73673
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user