virtual void startBlock( const Block *b, uint64_t ) { if(0<=cutoffBlock && cutoffBlock<b->height) wrapup(); uint8_t blockHash[kSHA256ByteSize]; sha256Twice(blockHash, b->data, 80); const uint8_t *p = b->data; SKIP(uint32_t, version, p); SKIP(uint256_t, prevBlkHash, p); SKIP(uint256_t, blkMerkleRoot, p); LOAD(uint32_t, blkTime, p); // id BIGINT PRIMARY KEY // hash BINARY(32) // time BIGINT fprintf(blockFile, "%" PRIu64 "\t", (blkID = b->height-1)); writeEscapedBinaryBuffer(blockFile, blockHash, kSHA256ByteSize); fputc('\t', blockFile); fprintf(blockFile, "%" PRIu64 "\n", (uint64_t)blkTime); if(0==(b->height)%500) { fprintf( stderr, "block=%8" PRIu64 " " "nbOutputs=%8" PRIu64 "\n", b->height, outputMap.size() ); } }
virtual void startBlock( const Block *b, uint64_t chainSize ) { uint8_t blockHash[kSHA256ByteSize]; sha256Twice(blockHash, b->data, 80); const uint8_t *p = b->data; SKIP(uint32_t, version, p); SKIP(uint256_t, prevBlkHash, p); SKIP(uint256_t, blkMerkleRoot, p); LOAD(uint32_t, blkTime, p); blkID = b->height - 1; if (blkID >= cutoffBlock) { // block_id BIGINT PRIMARY KEY // block_hash BINARY(32) // time BIGINT fprintf(blockFile, "%" PRIu64 "|", blkID); writeEscapedBinaryBuffer(blockFile, blockHash, kSHA256ByteSize); fputc('|', blockFile); fprintf(blockFile, "%" PRIu64 "\n", (uint64_t)blkTime); } if (0 == (blkID) % 5000) { fprintf( stderr, "block=%8" PRIu64 " " "nbOutputs=%9" PRIu64 "\n", blkID, outputMap.size() ); } }
virtual void startBlock( const Block *b, uint64_t ) { if (lastBlock < b->height) { wrapup(); } auto p = b->chunk->getData(); uint8_t blockHash[kSHA256ByteSize]; sha256Twice(blockHash, p, 80); SKIP(uint32_t, version, p); SKIP(uint256_t, prevBlkHash, p); SKIP(uint256_t, blkMerkleRoot, p); LOAD(uint32_t, blkTime, p); blkID = b->height - 1; if (blkID >= firstBlock) { fprintf(blockFile, "%" PRIu64 "|", blkID); writeHexEscapedBinaryBuffer(blockFile, blockHash, kSHA256ByteSize); fputc('|', blockFile); fprintf(blockFile, "%" PRIu64 "\n", (uint64_t)blkTime); } if (0 == blkID % 5000) { fprintf( stderr, "block=%8" PRIu64 " " "nbOutputs=%9" PRIu64 "\n", blkID, outputMap.size() ); } }