BchBlock

class BchBlock(val chainSelector: ChainSelector) : BchBlockHeader, iBlock

Constructors

Link copied to clipboard
constructor(chainSelector: ChainSelector, stream: BCHserialized)
constructor(chainSelector: ChainSelector)

Properties

Link copied to clipboard
Link copied to clipboard
abstract var chainWork: BigInteger
Link copied to clipboard
abstract var diffBits: Long
Link copied to clipboard
abstract val hash: Hash256

Return this block's hash. Uses a cached value if one exists. If you change the block be sure to call calcHash() or invalidateHash() to update this value either greedily or lazily respectively

Link copied to clipboard
abstract var hashAncestor: Hash256
Link copied to clipboard
Link copied to clipboard
abstract var hashMerkleRoot: Hash256
Link copied to clipboard
abstract var hashPrevBlock: Hash256
Link copied to clipboard
abstract var height: Long
Link copied to clipboard
var nonce: Long
Link copied to clipboard
abstract var size: Long
Link copied to clipboard
abstract var time: Long
Link copied to clipboard
abstract var txCount: Long
Link copied to clipboard
open override var txes: MutableList<BchTransaction>

list of transactions in the block

Link copied to clipboard
Link copied to clipboard
open val work: BigInteger

Functions

Link copied to clipboard
Link copied to clipboard
open override fun BCHdeserialize(stream: BCHserialized): BCHserialized

Deserializer Note that this includes the number of tx in NETWORK serialization as a legacy of the P2P network protocol. In DISK serialization, the block size in bytes is included.

Link copied to clipboard
open override fun BCHserialize(format: SerializationType): BCHserialized
Link copied to clipboard
Link copied to clipboard
abstract fun calcHash(): Hash256

Force recalculation of hash. To access the hash just use #hash, to force recalc call "changed()"

Link copied to clipboard
abstract fun changed()

Communicate that this object has been changed, so recalculation of cached data is needed

Link copied to clipboard

Deserialize just the header fields (used when this header is included in other objects/messages

Link copied to clipboard
open fun toByteArray(format: SerializationType = SerializationType.UNKNOWN): ByteArray
Link copied to clipboard
abstract fun validate(cs: ChainSelector): Boolean

run checks (such as verifying POW claim) & return true if the block header is consistent