资源简介
bitcoin_vs2017.zip
代码片段和文件信息
#include
#include
#include
#include
#include
#define MESSAGE_START_SIZE 4
unsigned char pchMessageStart[MESSAGE_START_SIZE] = { 0xf9 0xbe 0xb4 0xd9 };
bool LoadExternalBlockFile(FILE* fileIn CDiskBlockPos *dbp)
{
int nLoaded = 0;
try {
// This takes over fileIn and calls fclose() on it in the CBufferedFile destructor
CBufferedFile blkdat(fileIn 2 * MAX_BLOCK_SERIALIZED_SIZE MAX_BLOCK_SERIALIZED_SIZE + 8 SER_DISK CLIENT_VERSION);
uint64_t nRewind = blkdat.GetPos();
while (!blkdat.eof()) {
blkdat.SetPos(nRewind);
nRewind++; // start one byte further next time in case of failure
blkdat.SetLimit(); // remove former limit
unsigned int nSize = 0;
try {
// locate a header
unsigned char buf[MESSAGE_START_SIZE];
blkdat.FindByte(pchMessageStart[0]);
nRewind = blkdat.GetPos() + 1;
blkdat >> FLATDATA(buf);
if (memcmp(buf pchMessageStart MESSAGE_START_SIZE))
continue;
// read size
blkdat >> nSize;
if (nSize < 80 || nSize > MAX_BLOCK_SERIALIZED_SIZE)
continue;
}
catch (const std::exception&) {
// no valid block header found; don‘t complain
break;
}
try {
// read block
uint64_t nBlockPos = blkdat.GetPos();
if (dbp)
dbp->nPos = nBlockPos;
blkdat.SetLimit(nBlockPos + nSize);
blkdat.SetPos(nBlockPos);
std::shared_ptr pblock = std::make_shared();
CBlock& block = *pblock;
blkdat >> block;
nRewind = blkdat.GetPos();
printf(“%s\n\n“ block.ToString().c_str());
}
catch (const std::exception& e) {
printf(“%s: Deserialize or I/O error - %s\n“ __func__ e.what());
}
nLoaded++;
}
}
catch (const std::runtime_error& e) {
printf(“System error: %s\n“ e.what());
}
if (nLoaded > 0)
printf(“Loaded %i blocks from external file\n“ nLoaded);
return nLoaded > 0;
}
int main(void)
{
// Todo: Change to the real path where you store the bitcoin block file
char path[] = “G:\\blockchain\\bitcoin\\bin\\Bitcoin\\blocks\\blk00000.dat“;
FILE *file = fsbridge::fopen(path “rb“);
LoadExternalBlockFile(file NULL);
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-01 17:45 src\
目录 0 2018-03-01 18:41 src\532479301\
文件 2257 2018-03-01 18:41 src\532479301\main_showblock.cpp
目录 0 2018-03-01 18:42 build-aux\
目录 0 2018-03-01 18:42 build-aux\vs\
文件 12674 2018-02-27 18:51 build-aux\vs\bitcoin-config.h
文件 1427 2018-03-01 17:30 build-aux\vs\bitcoin.sln
文件 11089 2018-03-01 18:13 build-aux\vs\bitcoin.vcxproj
文件 3488 2018-03-01 18:12 build-aux\vs\bitcoin.vcxproj.filters
文件 306 2018-03-01 18:13 build-aux\vs\packages.config
相关资源
- zw_SplashesTable.zip
- WMTorrent种子清洗器.zip
- 计算机组成原理第五版.txt
- guilv.rar
- IEEE5.doc
- zint-源代码.zip
- FPXHUSB-ok.rar
- k1uomw.rar
- shuiguopeidui.aia
- 霍夫变换找圆.zip
- 校园导航系统.rar
- fn_check_creditCode.rar
- -Lyapunov指数的计算方法.doc
- ADC0809.rar
- UBOOTloadb命令加载应用程序到SDRAM中运
- 华为设备-eNSP配置说明.doc
- haarcascade_mcs_mouth2019.rar
- 国家互联网安全中心面试准备材料.
- EV_RWD_2NEW.rar
- CORBA开源测试工具.pdf
- 登陆界面二2012-12-25.rar
- 区块链开发入门到精通全套视频.txt
- FZ4与三菱PLC通讯总结.docx
- 997783QTableWidget表头添加复选框.zip
- 4c0138bbb96b33332ad8287cd800de13.zip
- 2018机器学习试题.doc
- PatentDocuments.rar
- GOLAY.c
- WCD9335.pdf
- PDLED8Test.exe
评论
共有 条评论