Class Blocks

java.lang.Object
com.norswap.nanoeth.blocks.Blocks

public final class Blocks
extends Object
A database that enables retrieving blocks by hash.

To retrieve blocks in the canonical chain by number, use Blockchain instead.

The current implementation is fully in-memory, and does not persist any block to disk.

  • Field Details

    • DB

      public static final Blocks DB
      Singleton blocks DB instance. TODO: enable running multiple nodes in parallel
  • Method Details

    • register

      public void register​(Block block)
      Registers the given block in the block DB.
    • get

      public Block get​(Hash hash)
      Returns the block with the given hash, or null if no such block is known.
    • getHeader

      public BlockHeader getHeader​(Hash hash)
    • clear

      public void clear()
      Empties the database.