资源简介
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
相关资源
- PID_AutoTune_v0.rar
- vspd7.2.308.zip
- 价值2k的H漫画小说系统
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- ddos压力测试工具99657
- UML建模大全
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- FTP课程设计(服务端+客户端)
- 计算机图形学 边填充算法实现代码
- 电力系统潮流计算程序集合
- oracle数据迁移项目实施方案
- Web Api 通过文件流 文件到本地
- Visio图标-最新最全的网络通信图标库
- Spire API文档
- OpenGL参考手册
- Python中Numpy库最新教程
- SPD博士V5.3.exe
- 直流无刷电机方波驱动 stm32 例程代码
- layui后台管理模板
- 仿知乎界面小程序源代码
- 云平台-阿里云详细介绍
- photoshop经典1000例
- scratch垃圾分类源码(最终版本).sb
- IAR ARM 7.8破解
- TI CCS V5.4 安装步骤及破解文件
- 松下plc FP-XH的驱动
- 局域网硬件信息收集工具
- 加快Windows XP操作系统开机速度
评论
共有 条评论