Class: CoinEntry

coins.CoinEntry

new CoinEntry()

A coin entry is an object which defers parsing of a coin. Say there is a transaction with 100 outputs. When a block comes in, there may only be one input in that entire block which redeems an output from that transaction. When parsing the Coins, there is no sense to get all of them into their abstract form. A coin entry is just a pointer to that coin in the Coins buffer, as well as a size. Parsing and decompression is done only if that coin is being redeemed.

Properties:
Name Type Description
offset Number
size Number
raw Buffer
output Output | null
spent Boolean
Source:

Methods

(static) fromCoin(coin) → {CoinEntry}

Instantiate coin entry from coin.

Parameters:
Name Type Description
coin Coin
Source:
Returns:
Type
CoinEntry

(static) fromOutput(output) → {CoinEntry}

Instantiate coin entry from output.

Parameters:
Name Type Description
output Output
Source:
Returns:
Type
CoinEntry

(static) fromReader(br) → {CoinEntry}

Instantiate coin entry from reader.

Parameters:
Name Type Description
br BufferReader
Source:
Returns:
Type
CoinEntry

getSize() → {Number}

Calculate coin entry size.

Source:
Returns:
Type
Number

(private) reader() → {BufferReader}

Instantiate a reader at the correct offset.

Source:
Returns:
Type
BufferReader

toCoin(coins, index) → {Coin}

Parse the deferred data and return a coin.

Parameters:
Name Type Description
coins Coins
index Number
Source:
Returns:
Type
Coin

toOutput() → {Output}

Parse the deferred data and return an output.

Source:
Returns:
Type
Output

toWriter()

Slice off the part of the buffer relevant to this particular coin.

Source: