tinychain

package
v0.0.0-...-a4a6c37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TheTinyChain = (chainreadinterface.IBlockChain)(&theTinyChain)

Access to the top level interface to the chain

Functions

func HashOfInt

func HashOfInt(in uint64) indexedhashes.Sha256

func TestBlock2Trans2_helper

func TestBlock2Trans2_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestGenesisBlock_helper

func TestGenesisBlock_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestGenesisHandle_helper

func TestGenesisHandle_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestGenesisNextParent_helper

func TestGenesisNextParent_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestGenesisParentInvalid_helper

func TestGenesisParentInvalid_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestGenesisTransaction_helper

func TestGenesisTransaction_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestInvalidHandle_helper

func TestInvalidHandle_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestLatestBlockNotGenesis_helper

func TestLatestBlockNotGenesis_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestLatestNextBlock_helper

func TestLatestNextBlock_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestLatestNextTransaction_helper

func TestLatestNextTransaction_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestLatestPrevNextBlock_helper

func TestLatestPrevNextBlock_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestThirdTransaction_helper

func TestThirdTransaction_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestTransaction_helper

func TestTransaction_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

Types

type Block

type Block struct {
	BlockHandle
	// contains filtered or unexported fields
}

func (*Block) NthTransaction

func (b *Block) NthTransaction(n int64) (chainreadinterface.ITransHandle, error)

func (*Block) TransactionCount

func (b *Block) TransactionCount() (int64, error)

type BlockHandle

type BlockHandle struct {
	HashHeight
}

BlockHandle implements IBlockHandle

func (*BlockHandle) IsBlockHandle

func (bh *BlockHandle) IsBlockHandle()

func (*BlockHandle) IsInvalid

func (bh *BlockHandle) IsInvalid() bool

type Blockchain

type Blockchain struct {
	// contains filtered or unexported fields
}

Blockchain implements IBlockchain (and so implicitly IBlockTree)

func (*Blockchain) BlockInterface

func (*Blockchain) GenesisBlock

func (bc *Blockchain) GenesisBlock() chainreadinterface.IBlockHandle

func (*Blockchain) GenesisTransaction

func (bc *Blockchain) GenesisTransaction() (chainreadinterface.ITransHandle, error)

func (*Blockchain) InvalidBlock

func (bc *Blockchain) InvalidBlock() chainreadinterface.IBlockHandle

func (*Blockchain) InvalidTrans

func (bc *Blockchain) InvalidTrans() chainreadinterface.ITransHandle

func (*Blockchain) IsBlockTree

func (bc *Blockchain) IsBlockTree() bool

func (*Blockchain) LatestBlock

func (bc *Blockchain) LatestBlock() (chainreadinterface.IBlockHandle, error)

Implement the rest of IBlockChain

func (*Blockchain) LatestTransaction

func (bc *Blockchain) LatestTransaction() (chainreadinterface.ITransHandle, error)

func (*Blockchain) NextBlock

func (*Blockchain) PreviousTransaction

func (*Blockchain) TxiInterface

func (*Blockchain) TxoInterface

type HashHeight

type HashHeight struct {
	// contains filtered or unexported fields
}

A HashHeight for tinychain that doesn't store a hash The hash is merely the hash of the height number

func (*HashHeight) Hash

func (hh *HashHeight) Hash() (indexedhashes.Sha256, error)

func (*HashHeight) HashSpecified

func (hh *HashHeight) HashSpecified() bool

func (*HashHeight) Height

func (hh *HashHeight) Height() int64

func (*HashHeight) HeightSpecified

func (hh *HashHeight) HeightSpecified() bool

type TransHandle

type TransHandle struct {
	HashHeight
}

TransHandle implements ITransHandle

func (*TransHandle) IndicesPath

func (th *TransHandle) IndicesPath() (int64, int64)

func (*TransHandle) IndicesPathSpecified

func (th *TransHandle) IndicesPathSpecified() bool

func (*TransHandle) IsInvalid

func (th *TransHandle) IsInvalid() bool

func (*TransHandle) IsTransHandle

func (th *TransHandle) IsTransHandle()

type TransIndex

type TransIndex struct {
	TransHandle
	// contains filtered or unexported fields
}

A TransIndex for tinychain

type Transaction

type Transaction struct {
	TransHandle
	// contains filtered or unexported fields
}

Transaction implements ITransaction

func (*Transaction) NthTxi

func (*Transaction) NthTxo

func (*Transaction) TxiCount

func (t *Transaction) TxiCount() (int64, error)

func (*Transaction) TxoCount

func (t *Transaction) TxoCount() (int64, error)

type Txi

type Txi struct {
	TxiHandle
	// contains filtered or unexported fields
}

func (Txi) SourceTxo

func (atxi Txi) SourceTxo() (chainreadinterface.ITxoHandle, error)

type TxiHandle

type TxiHandle struct {
	TxxHandle
}

func (*TxiHandle) IndicesPath

func (th *TxiHandle) IndicesPath() (int64, int64, int64)

func (*TxiHandle) IndicesPathSpecified

func (th *TxiHandle) IndicesPathSpecified() bool

func (*TxiHandle) ParentIndex

func (txi *TxiHandle) ParentIndex() int64

func (*TxiHandle) ParentSpecified

func (txi *TxiHandle) ParentSpecified() bool

func (*TxiHandle) ParentTrans

func (txi *TxiHandle) ParentTrans() chainreadinterface.ITransHandle

func (*TxiHandle) TxiHeight

func (txi *TxiHandle) TxiHeight() int64

func (*TxiHandle) TxiHeightSpecified

func (th *TxiHandle) TxiHeightSpecified() bool

type Txo

type Txo struct {
	TxoHandle
	// contains filtered or unexported fields
}

A transaction output supporting the ITxo interface

func (Txo) Satoshis

func (atxo Txo) Satoshis() (int64, error)

type TxoHandle

type TxoHandle struct {
	TxxHandle
}

func (*TxoHandle) IndicesPath

func (txo *TxoHandle) IndicesPath() (int64, int64, int64)

func (*TxoHandle) IndicesPathSpecified

func (txo *TxoHandle) IndicesPathSpecified() bool

func (*TxoHandle) ParentIndex

func (txo *TxoHandle) ParentIndex() int64

func (*TxoHandle) ParentSpecified

func (txo *TxoHandle) ParentSpecified() bool

func (*TxoHandle) ParentTrans

func (txo *TxoHandle) ParentTrans() chainreadinterface.ITransHandle

func (*TxoHandle) TxoHeight

func (txo *TxoHandle) TxoHeight() int64

func (*TxoHandle) TxoHeightSpecified

func (txo *TxoHandle) TxoHeightSpecified() bool

type TxxHandle

type TxxHandle struct {
	TransIndex
	// contains filtered or unexported fields
}

A TxxHandle for tinychain

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL