Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NullNode<V>

Represents a null node, which is -only- used at the root of the tree to represent a tree with no elements.

Type parameters

  • V

Hierarchy

Index

Properties

markForCopy

markForCopy: boolean = false

Only used for batchCOW to mark nodes to be copied

nibbles

nibbles: never[] = []

A null node always has no nibbles.

rlpNodeEncoding

rlpNodeEncoding: Buffer | null = null

Memoizing RLP encoding of the serialized node

Static HUMAN_READABLE_HASH_LENGTH

HUMAN_READABLE_HASH_LENGTH: number = 6

When calling toString(), sets the length of the hashes printed.

Static HUMAN_READABLE_VAL_LENGTH

HUMAN_READABLE_VAL_LENGTH: number = 6

When calling toString(), sets the length of the values printed. Values longer will be appended with ...

Accessors

value

  • set value(val: V): void

Methods

clearMemoizedHash

  • clearMemoizedHash(): void

clearRlpNodeEncoding

  • clearRlpNodeEncoding(): void

getNodeRlpSize

getRlpNodeEncoding

hash

  • hash(): bigint

next

  • next(nibbles: number[]): object

serialize

  • serialize(): Buffer

toReadableHash

toString

  • toString(): string
  • Returns the string representation of this null node.

    Returns string

Static bufferToNibbles

  • bufferToNibbles(buffer: Buffer): number[]

Static fromBuffer

  • fromBuffer(out: Buffer): object

Static intersectingPrefix

  • intersectingPrefix(n0: number[], n1: number[]): number[]
  • Return the intersecting prefix, which contains the nibbles shared by both n0 and n1 at the beginning of each nibble set.

    Parameters

    • n0: number[]

      The first set of nibbles

    • n1: number[]

      The second set of nibbles

    Returns number[]

    A set of nibbles representing the intersecting prefix of both input sets.

Static nibblesAsHex

  • nibblesAsHex(nibbles: number[]): string
  • Converts a set of nibbles to its representation as a hex string.

    Parameters

    • nibbles: number[]

      The nibbles to convert.

    Returns string

    The input nibbles as a hex string.

Static toBuffer

  • toBuffer(nibbles: number[], prefix: number): Buffer
  • Converts a set of nibbles and an attached prefix to its buffer representation.

    Parameters

    • nibbles: number[]

      The nibbles to convert.

    • prefix: number

      The prefix for the nibbles to convert.

    Returns Buffer

    The representation of the nibbles with the given prefix as a buffer.

Static toReadableValue

  • toReadableValue<V>(val: V): string
  • Converts a value to a human readable value. This is set to the first n characters of the hex representation of a value, as defined by HUMAN_READABLE_VAL_LENGTH.

    Type parameters

    • V

    Parameters

    • val: V

      The value to convert.

    Returns string

    A human readable value string

Generated using TypeDoc