bitcoin core – What’s up with the block measurement of block# 295182?

0
25


I discovered an anomaly within the block measurement information: block 295182. This one appears to have a manner larger payload. What occurred there?


Or is that this there one thing mistaken with my parsing? This file block does look like on the finish of a .dat file.

This is the code I used:

import struct
import matplotlib.pyplot as plt

blockchain_path="mypath/blocks"

def get_block_path(index):
  file="blk" + str(index).zfill(5) + '.dat'
  return blockchain_path + "https://bitcoin.stackexchange.com/" + file

def plot(x, y, title, xlabel, ylabel):
  plt.scatter(x, y)
  plt.suptitle(title, fontsize=20)
  plt.xlabel(xlabel)
  plt.ylabel(ylabel)
  plt.present()

def uint4(stream):
  return struct.unpack('I', stream.learn(4))[0]

def blocks_remaining(f):
  cur = f.inform()
  strive:
    uint4(f)
    f.search(cur)
    return True
  besides:
    print("Finish of file")
    return False

BlockHeight, BlockSize = ([] for i in vary(2))
cur_block_height = -1


for i in vary(0, 1000):
  block_path = get_block_path(i)
  #stick with single file
  f = open(block_path, 'rb', buffering=16 * 1024 * 1024)
  

  #loop blocks in file
  whereas blocks_remaining(f):
    cur_block_height += 1
    magic_num = uint4(f)
    block_size = uint4(f)

    print(cur_block_height, f.inform(), magic_num, block_size)

    #append information
    BlockHeight.append(cur_block_height)
    BlockSize.append(block_size)

    #skip to subsequent block
    f.learn(block_size)

plot(BlockHeight, BlockSize, 'Block Measurement', 'block top', 'bytes')



Supply hyperlink

Leave a reply