From f527fcdb9723e59e45f4f8094b06a0fb8a4ae219 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Apr 2018 17:46:08 +0300 Subject: [PATCH] Test --- src/komodo_bitcoind.h | 6 +++--- src/main.cpp | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index d88c7ddad..f5e8a6707 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -662,7 +662,7 @@ int32_t komodo_block2height(CBlock *block) void komodo_block2pubkey33(uint8_t *pubkey33,CBlock& block) { int32_t n; - memset(pubkey33,0,33); + memset(pubkey33,0xff,33); if ( block.vtx[0].vout.size() > 0 ) { #ifdef KOMODO_ZCASH @@ -732,9 +732,9 @@ void komodo_pindex_init(CBlockIndex *pindex,int32_t height) pindex->notaryid = -1; if ( pindex->pubkey33[0] != 2 && pindex->pubkey33[0] != 3 && pindex->pubkey33[0] != 0xff ) { - if ( KOMODO_LOADINGBLOCKS == 0 ) + //if ( KOMODO_LOADINGBLOCKS == 0 ) memset(pindex->pubkey33,0xff,33); - else memset(pindex->pubkey33,0,33); + //else memset(pindex->pubkey33,0,33); if ( komodo_blockload(block,pindex) == 0 ) { komodo_block2pubkey33(pindex->pubkey33,block); diff --git a/src/main.cpp b/src/main.cpp index 884112cde..85066fd9f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4037,6 +4037,7 @@ bool CheckDiskSpace(uint64_t nAdditionalBytes) FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly) { + int32_t incr; if (pos.IsNull()) return NULL; boost::filesystem::path path = GetBlockPosFilename(pos, prefix); @@ -4048,6 +4049,26 @@ FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly) LogPrintf("Unable to open file %s\n", path.string()); return NULL; } + if ( strcmp(prefix,(char *)"blk") == 0 ) + { + long fsize,fpos; int32_t incr = 16*1024*1024; + fpos = ftell(file); + fseek(file,0,SEEK_END); + fsize = ftell(file); + if ( fsize > incr ) + { + char *ignore = malloc(incr); + if ( ignore != 0 ) + { + rewind(file); + while ( fread(ignore,1,incr,file) == incr ) + fprintf(stderr,"."); + free(ignore); + fprintf(stderr,"loaded %ld bytes set fpos.%ld\n",(long)ftell(file),(long)fpos); + } + } + fseek(file,fpos,SEEK_SET); + } if (pos.nPos) { if (fseek(file, pos.nPos, SEEK_SET)) { LogPrintf("Unable to seek to position %u of %s\n", pos.nPos, path.string());