Constructor
new Headers(optionsopt)
Create headers.
Extends:
- AbstractBlock
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<optional> |
- Source:
Extends
- AbstractBlock
Methods
(static) fromBlock(block) → {Headers}
Convert the block to a headers object.
Parameters:
Name | Type | Description |
---|---|---|
block |
Block | MerkleBlock |
- Source:
Returns:
- Type
- Headers
(static) fromEntry(entry) → {Headers}
Instantiate headers from a chain entry.
Parameters:
Name | Type | Description |
---|---|---|
entry |
ChainEntry |
- Source:
Returns:
- Type
- Headers
(static) fromHead(data) → {Headers}
Instantiate headers from serialized data.
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer |
- Source:
Returns:
- Type
- Headers
(static) isHeaders(obj) → {Boolean}
Test an object to see if it is a Headers object.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object |
- Source:
Returns:
- Type
- Boolean
format(viewopt, heightopt) → {Object}
Inspect the headers and return a more user-friendly representation of the data.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
view |
CoinView |
<optional> |
|
height |
Number |
<optional> |
- Source:
Returns:
- Type
- Object
fromJSON(json)
Inject properties from json object.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object |
- Source:
getJSON(networkopt, nullable, viewopt, heightopt) → {Object}
Convert the block to an object suitable for JSON serialization.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
network |
NetworkType | Network |
<optional> <nullable> |
|
view |
CoinView |
<optional> |
|
height |
Number |
<optional> |
- Source:
Returns:
- Type
- Object
getSize() → {Number}
Get size of the headers.
- Source:
Returns:
- Type
- Number
read(br)
Inject properties from buffer reader.
Parameters:
Name | Type | Description |
---|---|---|
br |
BufferReader |
- Source:
toHeaders() → {Headers}
Convert the block to a headers object.
- Source:
Returns:
- Type
- Headers
verifyBody() → {Boolean}
Perform non-contextual verification on the headers.
- Source:
Returns:
- Type
- Boolean
write(bw) → {BufioWriter}
Serialize the headers to a buffer writer.
Parameters:
Name | Type | Description |
---|---|---|
bw |
BufioWriter |
- Source:
Returns:
- Type
- BufioWriter