Documentation
¶
Index ¶
- type Config
- type Digest
- type Handle
- type Header
- type LocalChain
- func (lc *LocalChain) AppendHeader(header *Header)
- func (lc *LocalChain) GetBlockCount() (int64, error)
- func (lc *LocalChain) GetHeaderByDigest(digest Digest) (*Header, error)
- func (lc *LocalChain) GetHeaderByHeight(height int64) (*Header, error)
- func (lc *LocalChain) SetHeaders(headers []*Header)
- func (lc *LocalChain) SetOrphanedHeaders(headers []*Header)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config is a struct that contains the configuration needed to connect to a Bitcoin node.
type Handle ¶
type Handle interface { // GetHeaderByHeight returns the block header from the longest block chain at // the given block height. GetHeaderByHeight(height int64) (*Header, error) // GetHeaderByDigest returns the block header for given digest (hash). GetHeaderByDigest(digest Digest) (*Header, error) // GetBlockCount returns the number of blocks in the longest blockchain GetBlockCount() (int64, error) }
Handle represents a handle to the Bitcoin chain.
func ConnectLocal ¶
ConnectLocal connects to the local Bitcoin chain and returns a chain handle.
type Header ¶
type Header struct { // Hash is the hash of the block. Hash Digest // Height is the height of the block in the Bitcoin blockchain. Height int64 // PrevHash is the hash of the previous block. PrevHash Digest // MerkleRoot is the hash of the root of the merkle tree of transactions in // the block. MerkleRoot Digest // Raw is the serialized data of the block header (80-byte little-endian). Raw []byte }
Header represents a Bitcoin block header.
type LocalChain ¶
type LocalChain struct {
// contains filtered or unexported fields
}
LocalChain represents a local Bitcoin chain.
func (*LocalChain) AppendHeader ¶
func (lc *LocalChain) AppendHeader(header *Header)
AppendHeader appends internal header for testing purposes.
func (*LocalChain) GetBlockCount ¶
func (lc *LocalChain) GetBlockCount() (int64, error)
GetBlockCount returns the number of blocks in the longest blockchain
func (*LocalChain) GetHeaderByDigest ¶
func (lc *LocalChain) GetHeaderByDigest( digest Digest, ) (*Header, error)
GetHeaderByDigest returns the block header for given digest (hash).
func (*LocalChain) GetHeaderByHeight ¶
func (lc *LocalChain) GetHeaderByHeight(height int64) (*Header, error)
GetHeaderByHeight returns the block header from the longest block chain at the given block height.
func (*LocalChain) SetHeaders ¶
func (lc *LocalChain) SetHeaders(headers []*Header)
SetHeaders sets internal headers for testing purposes.
func (*LocalChain) SetOrphanedHeaders ¶
func (lc *LocalChain) SetOrphanedHeaders(headers []*Header)
SetOrphanedHeaders sets internal orphaned headers for testing purposes.