Documentation ¶
Index ¶
- Constants
- func HashesEqual(a, b []*DomainHash) bool
- func ParentsEqual(a, b []BlockLevelParents) bool
- type AcceptanceData
- type BaseBlockHeader
- type BlockAcceptanceData
- type BlockAdded
- type BlockGHOSTDAGData
- func (bgd *BlockGHOSTDAGData) BlueScore() uint64
- func (bgd *BlockGHOSTDAGData) BlueWork() *big.Int
- func (bgd *BlockGHOSTDAGData) BluesAnticoneSizes() map[DomainHash]KType
- func (bgd *BlockGHOSTDAGData) MergeSetBlues() []*DomainHash
- func (bgd *BlockGHOSTDAGData) MergeSetReds() []*DomainHash
- func (bgd *BlockGHOSTDAGData) SelectedParent() *DomainHash
- type BlockGHOSTDAGDataHashPair
- type BlockHeader
- type BlockInfo
- type BlockLevelParents
- type BlockLocator
- type BlockStatus
- type BlockWithTrustedData
- type Consensus
- type ConsensusEvent
- type DomainBlock
- type DomainBlockTemplate
- type DomainCoinbaseData
- type DomainHash
- func CloneHashes(hashes []*DomainHash) []*DomainHash
- func NewDomainHashFromByteArray(hashBytes *[DomainHashSize]byte) *DomainHash
- func NewDomainHashFromByteSlice(hashBytes []byte) (*DomainHash, error)
- func NewDomainHashFromString(hashString string) (*DomainHash, error)
- func NewZeroHash() *DomainHash
- func (hash *DomainHash) ByteArray() *[DomainHashSize]byte
- func (hash *DomainHash) ByteSlice() []byte
- func (hash *DomainHash) Equal(other *DomainHash) bool
- func (hash *DomainHash) Less(other *DomainHash) bool
- func (hash *DomainHash) LessOrEqual(other *DomainHash) bool
- func (hash DomainHash) String() string
- type DomainOutpoint
- type DomainSubnetworkID
- type DomainTransaction
- type DomainTransactionID
- func (id *DomainTransactionID) ByteArray() *[DomainHashSize]byte
- func (id *DomainTransactionID) ByteSlice() []byte
- func (id *DomainTransactionID) Clone() *DomainTransactionID
- func (id *DomainTransactionID) Equal(other *DomainTransactionID) bool
- func (id *DomainTransactionID) Less(other *DomainTransactionID) bool
- func (id *DomainTransactionID) LessOrEqual(other *DomainTransactionID) bool
- func (id DomainTransactionID) String() string
- type DomainTransactionInput
- type DomainTransactionOutput
- type KType
- type MutableBlockHeader
- type MutableUTXODiff
- type OutpointAndUTXOEntryPair
- type PruningPointProof
- type ReadOnlyUTXOSetIterator
- type ScriptPublicKey
- type SelectedChainPath
- type SyncInfo
- type TransactionAcceptanceData
- type TrustedDataDataDAAHeader
- type UTXOCollection
- type UTXODiff
- type UTXOEntry
- type VirtualChangeSet
- type VirtualInfo
Constants ¶
const DomainHashSize = 32
DomainHashSize of array used to store hashes.
const DomainSubnetworkIDSize = 20
DomainSubnetworkIDSize is the size of the array used to store subnetwork IDs.
Variables ¶
This section is empty.
Functions ¶
func HashesEqual ¶
func HashesEqual(a, b []*DomainHash) bool
HashesEqual returns whether the given hash slices are equal.
func ParentsEqual ¶
func ParentsEqual(a, b []BlockLevelParents) bool
ParentsEqual returns true if all the BlockLevelParents in `a` and `b` are equal pairwise
Types ¶
type AcceptanceData ¶
type AcceptanceData []*BlockAcceptanceData
AcceptanceData stores data about which transactions were accepted by a block. It's ordered in the same way as the block merge set blues.
func (AcceptanceData) Clone ¶
func (ad AcceptanceData) Clone() AcceptanceData
Clone clones the AcceptanceData
func (AcceptanceData) Equal ¶
func (ad AcceptanceData) Equal(other AcceptanceData) bool
Equal returns whether ad equals to other
type BaseBlockHeader ¶
type BaseBlockHeader interface { Version() uint16 Parents() []BlockLevelParents DirectParents() BlockLevelParents HashMerkleRoot() *DomainHash AcceptedIDMerkleRoot() *DomainHash UTXOCommitment() *DomainHash TimeInMilliseconds() int64 Bits() uint32 Nonce() uint64 DAAScore() uint64 BlueScore() uint64 BlueWork() *big.Int PruningPoint() *DomainHash BlockLevel(maxBlockLevel int) int Equal(other BaseBlockHeader) bool }
BaseBlockHeader represents the header part of a Pyrin block
type BlockAcceptanceData ¶
type BlockAcceptanceData struct { BlockHash *DomainHash TransactionAcceptanceData []*TransactionAcceptanceData }
BlockAcceptanceData stores all transactions in a block with an indication if they were accepted or not by some other block
func (*BlockAcceptanceData) Clone ¶
func (bad *BlockAcceptanceData) Clone() *BlockAcceptanceData
Clone returns a clone of BlockAcceptanceData
func (*BlockAcceptanceData) Equal ¶
func (bad *BlockAcceptanceData) Equal(other *BlockAcceptanceData) bool
Equal returns whether bad equals to other
type BlockAdded ¶
type BlockAdded struct {
Block *DomainBlock
}
BlockAdded is an event raised by consensus when a block was added to the dag
type BlockGHOSTDAGData ¶
type BlockGHOSTDAGData struct {
// contains filtered or unexported fields
}
BlockGHOSTDAGData represents GHOSTDAG data for some block
func NewBlockGHOSTDAGData ¶
func NewBlockGHOSTDAGData( blueScore uint64, blueWork *big.Int, selectedParent *DomainHash, mergeSetBlues []*DomainHash, mergeSetReds []*DomainHash, bluesAnticoneSizes map[DomainHash]KType) *BlockGHOSTDAGData
NewBlockGHOSTDAGData creates a new instance of BlockGHOSTDAGData
func (*BlockGHOSTDAGData) BlueScore ¶
func (bgd *BlockGHOSTDAGData) BlueScore() uint64
BlueScore returns the BlueScore of the block
func (*BlockGHOSTDAGData) BlueWork ¶
func (bgd *BlockGHOSTDAGData) BlueWork() *big.Int
BlueWork returns the BlueWork of the block
func (*BlockGHOSTDAGData) BluesAnticoneSizes ¶
func (bgd *BlockGHOSTDAGData) BluesAnticoneSizes() map[DomainHash]KType
BluesAnticoneSizes returns a map between the blocks in its MergeSetBlues and the size of their anticone
func (*BlockGHOSTDAGData) MergeSetBlues ¶
func (bgd *BlockGHOSTDAGData) MergeSetBlues() []*DomainHash
MergeSetBlues returns the MergeSetBlues of the block (not a copy)
func (*BlockGHOSTDAGData) MergeSetReds ¶
func (bgd *BlockGHOSTDAGData) MergeSetReds() []*DomainHash
MergeSetReds returns the MergeSetReds of the block (not a copy)
func (*BlockGHOSTDAGData) SelectedParent ¶
func (bgd *BlockGHOSTDAGData) SelectedParent() *DomainHash
SelectedParent returns the SelectedParent of the block
type BlockGHOSTDAGDataHashPair ¶
type BlockGHOSTDAGDataHashPair struct { Hash *DomainHash GHOSTDAGData *BlockGHOSTDAGData }
BlockGHOSTDAGDataHashPair is a pair of a block hash and its ghostdag data
type BlockHeader ¶
type BlockHeader interface { BaseBlockHeader ToMutable() MutableBlockHeader }
BlockHeader represents an immutable block header.
type BlockInfo ¶
type BlockInfo struct { Exists bool BlockStatus BlockStatus BlueScore uint64 BlueWork *big.Int SelectedParent *DomainHash MergeSetBlues []*DomainHash MergeSetReds []*DomainHash }
BlockInfo contains various information about a specific block
type BlockLevelParents ¶
type BlockLevelParents []*DomainHash
BlockLevelParents represent the parents within a single super-block level See https://github.com/Pyrinpyi/research/issues/3 for further details
func CloneParents ¶
func CloneParents(parents []BlockLevelParents) []BlockLevelParents
CloneParents creates a clone of the given BlockLevelParents slice
func (BlockLevelParents) Clone ¶
func (sl BlockLevelParents) Clone() BlockLevelParents
Clone creates a clone of this BlockLevelParents
func (BlockLevelParents) Contains ¶
func (sl BlockLevelParents) Contains(blockHash *DomainHash) bool
Contains returns true if this BlockLevelParents contains the given blockHash
func (BlockLevelParents) Equal ¶
func (sl BlockLevelParents) Equal(other BlockLevelParents) bool
Equal returns true if this BlockLevelParents is equal to `other`
type BlockLocator ¶
type BlockLocator []*DomainHash
BlockLocator is used to help locate a specific block. The algorithm for building the block locator is to add block hashes in reverse order on the block's selected parent chain until the desired stop block is reached. In order to keep the list of locator hashes to a reasonable number of entries, the step between each entry is doubled each loop iteration to exponentially decrease the number of hashes as a function of the distance from the block being located.
For example, assume a selected parent chain with IDs as depicted below, and the stop block is genesis:
genesis -> 1 -> 2 -> ... -> 15 -> 16 -> 17 -> 18
The block locator for block 17 would be the hashes of blocks:
[17 16 14 11 7 2 genesis]
func (BlockLocator) Clone ¶
func (locator BlockLocator) Clone() BlockLocator
Clone returns a clone of BlockLocator
type BlockStatus ¶
type BlockStatus byte
BlockStatus represents the validation state of the block.
const ( // StatusInvalid indicates that the block is invalid. StatusInvalid BlockStatus = iota // StatusUTXOValid indicates the block is valid from any UTXO related aspects and has passed all the other validations as well. StatusUTXOValid // StatusUTXOPendingVerification indicates that the block is pending verification against its past UTXO-Set, either // because it was not yet verified since the block was never in the selected parent chain, or if the // block violates finality. StatusUTXOPendingVerification // StatusDisqualifiedFromChain indicates that the block is not eligible to be a selected parent. StatusDisqualifiedFromChain // StatusHeaderOnly indicates that the block transactions are not held (pruned or wasn't added yet) StatusHeaderOnly )
func (BlockStatus) Clone ¶
func (bs BlockStatus) Clone() BlockStatus
Clone returns a clone of BlockStatus
func (BlockStatus) Equal ¶
func (bs BlockStatus) Equal(other BlockStatus) bool
Equal returns whether bs equals to other
func (BlockStatus) String ¶
func (bs BlockStatus) String() string
type BlockWithTrustedData ¶
type BlockWithTrustedData struct { Block *DomainBlock DAAWindow []*TrustedDataDataDAAHeader GHOSTDAGData []*BlockGHOSTDAGDataHashPair }
BlockWithTrustedData is a block with pre-filled data that is not validated by the consensus. This is used when bring the pruning point and its anticone on a pruned-headers node.
type Consensus ¶
type Consensus interface { Init(skipAddingGenesis bool) error BuildBlock(coinbaseData *DomainCoinbaseData, transactions []*DomainTransaction) (*DomainBlock, error) BuildBlockTemplate(coinbaseData *DomainCoinbaseData, transactions []*DomainTransaction) (*DomainBlockTemplate, error) ValidateAndInsertBlock(block *DomainBlock, updateVirtual bool) error ValidateAndInsertBlockWithTrustedData(block *BlockWithTrustedData, validateUTXO bool) error ValidateTransactionAndPopulateWithConsensusData(transaction *DomainTransaction) error ImportPruningPoints(pruningPoints []BlockHeader) error BuildPruningPointProof() (*PruningPointProof, error) ValidatePruningPointProof(pruningPointProof *PruningPointProof) error ApplyPruningPointProof(pruningPointProof *PruningPointProof) error GetBlock(blockHash *DomainHash) (*DomainBlock, bool, error) GetBlockEvenIfHeaderOnly(blockHash *DomainHash) (*DomainBlock, error) GetBlockHeader(blockHash *DomainHash) (BlockHeader, error) GetBlockInfo(blockHash *DomainHash) (*BlockInfo, error) GetBlockRelations(blockHash *DomainHash) (parents []*DomainHash, children []*DomainHash, err error) GetBlockAcceptanceData(blockHash *DomainHash) (AcceptanceData, error) GetBlocksAcceptanceData(blockHashes []*DomainHash) ([]AcceptanceData, error) GetHashesBetween(lowHash, highHash *DomainHash, maxBlocks uint64) (hashes []*DomainHash, actualHighHash *DomainHash, err error) GetAnticone(blockHash, contextHash *DomainHash, maxBlocks uint64) (hashes []*DomainHash, err error) GetMissingBlockBodyHashes(highHash *DomainHash) ([]*DomainHash, error) GetPruningPointUTXOs(expectedPruningPointHash *DomainHash, fromOutpoint *DomainOutpoint, limit int) ([]*OutpointAndUTXOEntryPair, error) GetVirtualUTXOs(expectedVirtualParents []*DomainHash, fromOutpoint *DomainOutpoint, limit int) ([]*OutpointAndUTXOEntryPair, error) PruningPoint() (*DomainHash, error) PruningPointHeaders() ([]BlockHeader, error) PruningPointAndItsAnticone() ([]*DomainHash, error) ClearImportedPruningPointData() error AppendImportedPruningPointUTXOs(outpointAndUTXOEntryPairs []*OutpointAndUTXOEntryPair) error ValidateAndInsertImportedPruningPoint(newPruningPoint *DomainHash) error GetVirtualSelectedParent() (*DomainHash, error) CreateBlockLocatorFromPruningPoint(highHash *DomainHash, limit uint32) (BlockLocator, error) CreateHeadersSelectedChainBlockLocator(lowHash, highHash *DomainHash) (BlockLocator, error) CreateFullHeadersSelectedChainBlockLocator() (BlockLocator, error) GetSyncInfo() (*SyncInfo, error) Tips() ([]*DomainHash, error) GetVirtualInfo() (*VirtualInfo, error) GetVirtualDAAScore() (uint64, error) IsValidPruningPoint(blockHash *DomainHash) (bool, error) ArePruningPointsViolatingFinality(pruningPoints []BlockHeader) (bool, error) GetVirtualSelectedParentChainFromBlock(blockHash *DomainHash) (*SelectedChainPath, error) IsInSelectedParentChainOf(blockHashA *DomainHash, blockHashB *DomainHash) (bool, error) GetHeadersSelectedTip() (*DomainHash, error) Anticone(blockHash *DomainHash) ([]*DomainHash, error) EstimateNetworkHashesPerSecond(startHash *DomainHash, windowSize int) (uint64, error) PopulateMass(transaction *DomainTransaction) ResolveVirtual(progressReportCallback func(uint64, uint64)) error BlockDAAWindowHashes(blockHash *DomainHash) ([]*DomainHash, error) TrustedDataDataDAAHeader(trustedBlockHash, daaBlockHash *DomainHash, daaBlockWindowIndex uint64) (*TrustedDataDataDAAHeader, error) TrustedBlockAssociatedGHOSTDAGDataBlockHashes(blockHash *DomainHash) ([]*DomainHash, error) TrustedGHOSTDAGData(blockHash *DomainHash) (*BlockGHOSTDAGData, error) IsChainBlock(blockHash *DomainHash) (bool, error) VirtualMergeDepthRoot() (*DomainHash, error) IsNearlySynced() (bool, error) }
Consensus maintains the current core state of the node
type ConsensusEvent ¶
type ConsensusEvent interface {
// contains filtered or unexported methods
}
ConsensusEvent is an interface type that is implemented by all events raised by consensus
type DomainBlock ¶
type DomainBlock struct { Header BlockHeader Transactions []*DomainTransaction }
DomainBlock represents a Pyrin block
func (*DomainBlock) Clone ¶
func (block *DomainBlock) Clone() *DomainBlock
Clone returns a clone of DomainBlock
func (*DomainBlock) Equal ¶
func (block *DomainBlock) Equal(other *DomainBlock) bool
Equal returns whether block equals to other
type DomainBlockTemplate ¶
type DomainBlockTemplate struct { Block *DomainBlock CoinbaseData *DomainCoinbaseData CoinbaseHasRedReward bool IsNearlySynced bool }
DomainBlockTemplate contains a Block plus metadata related to its generation
func (*DomainBlockTemplate) Clone ¶
func (bt *DomainBlockTemplate) Clone() *DomainBlockTemplate
Clone returns a clone of DomainBlockTemplate
type DomainCoinbaseData ¶
type DomainCoinbaseData struct { ScriptPublicKey *ScriptPublicKey ExtraData []byte }
DomainCoinbaseData contains data by which a coinbase transaction is built
func (*DomainCoinbaseData) Clone ¶
func (dcd *DomainCoinbaseData) Clone() *DomainCoinbaseData
Clone returns a clone of DomainCoinbaseData
func (*DomainCoinbaseData) Equal ¶
func (dcd *DomainCoinbaseData) Equal(other *DomainCoinbaseData) bool
Equal returns whether dcd equals to other
type DomainHash ¶
type DomainHash struct {
// contains filtered or unexported fields
}
DomainHash is the domain representation of a Hash
func CloneHashes ¶
func CloneHashes(hashes []*DomainHash) []*DomainHash
CloneHashes returns a clone of the given hashes slice. Note: since DomainHash is a read-only type, the clone is shallow
func NewDomainHashFromByteArray ¶
func NewDomainHashFromByteArray(hashBytes *[DomainHashSize]byte) *DomainHash
NewDomainHashFromByteArray constructs a new DomainHash out of a byte array
func NewDomainHashFromByteSlice ¶
func NewDomainHashFromByteSlice(hashBytes []byte) (*DomainHash, error)
NewDomainHashFromByteSlice constructs a new DomainHash out of a byte slice. Returns an error if the length of the byte slice is not exactly `DomainHashSize`
func NewDomainHashFromString ¶
func NewDomainHashFromString(hashString string) (*DomainHash, error)
NewDomainHashFromString constructs a new DomainHash out of a hex-encoded string. Returns an error if the length of the string is not exactly `DomainHashSize * 2`
func NewZeroHash ¶
func NewZeroHash() *DomainHash
NewZeroHash returns a DomainHash that represents the zero value (0x000000...000)
func (*DomainHash) ByteArray ¶
func (hash *DomainHash) ByteArray() *[DomainHashSize]byte
ByteArray returns the bytes in this hash represented as a byte array. The hash bytes are cloned, therefore it is safe to modify the resulting array.
func (*DomainHash) ByteSlice ¶
func (hash *DomainHash) ByteSlice() []byte
ByteSlice returns the bytes in this hash represented as a byte slice. The hash bytes are cloned, therefore it is safe to modify the resulting slice.
func (*DomainHash) Equal ¶
func (hash *DomainHash) Equal(other *DomainHash) bool
Equal returns whether hash equals to other
func (*DomainHash) Less ¶
func (hash *DomainHash) Less(other *DomainHash) bool
Less returns true if hash is less than other
func (*DomainHash) LessOrEqual ¶
func (hash *DomainHash) LessOrEqual(other *DomainHash) bool
LessOrEqual returns true if hash is smaller or equal to other
func (DomainHash) String ¶
func (hash DomainHash) String() string
String returns the Hash as the hexadecimal string of the hash.
type DomainOutpoint ¶
type DomainOutpoint struct { TransactionID DomainTransactionID Index uint32 }
DomainOutpoint represents a Pyrin transaction outpoint
func NewDomainOutpoint ¶
func NewDomainOutpoint(id *DomainTransactionID, index uint32) *DomainOutpoint
NewDomainOutpoint instantiates a new DomainOutpoint with the given id and index
func (*DomainOutpoint) Clone ¶
func (op *DomainOutpoint) Clone() *DomainOutpoint
Clone returns a clone of DomainOutpoint
func (*DomainOutpoint) Equal ¶
func (op *DomainOutpoint) Equal(other *DomainOutpoint) bool
Equal returns whether op equals to other
func (DomainOutpoint) String ¶
func (op DomainOutpoint) String() string
String stringifies an outpoint.
type DomainSubnetworkID ¶
type DomainSubnetworkID [DomainSubnetworkIDSize]byte
DomainSubnetworkID is the domain representation of a Subnetwork ID
func (*DomainSubnetworkID) Clone ¶
func (id *DomainSubnetworkID) Clone() *DomainSubnetworkID
Clone returns a clone of DomainSubnetworkID
func (*DomainSubnetworkID) Equal ¶
func (id *DomainSubnetworkID) Equal(other *DomainSubnetworkID) bool
Equal returns whether id equals to other
func (DomainSubnetworkID) String ¶
func (id DomainSubnetworkID) String() string
String stringifies a subnetwork ID.
type DomainTransaction ¶
type DomainTransaction struct { Version uint16 Inputs []*DomainTransactionInput Outputs []*DomainTransactionOutput LockTime uint64 SubnetworkID DomainSubnetworkID Gas uint64 Payload []byte Fee uint64 Mass uint64 // ID is a field that is used to cache the transaction ID. // Always use consensushashing.TransactionID instead of accessing this field directly ID *DomainTransactionID }
DomainTransaction represents a Pyrin transaction
func (*DomainTransaction) Clone ¶
func (tx *DomainTransaction) Clone() *DomainTransaction
Clone returns a clone of DomainTransaction
func (*DomainTransaction) Equal ¶
func (tx *DomainTransaction) Equal(other *DomainTransaction) bool
Equal returns whether tx equals to other
type DomainTransactionID ¶
type DomainTransactionID DomainHash
DomainTransactionID represents the ID of a Pyrin transaction
func NewDomainTransactionIDFromByteArray ¶
func NewDomainTransactionIDFromByteArray(transactionIDBytes *[DomainHashSize]byte) *DomainTransactionID
NewDomainTransactionIDFromByteArray constructs a new TransactionID out of a byte array
func NewDomainTransactionIDFromByteSlice ¶
func NewDomainTransactionIDFromByteSlice(transactionIDBytes []byte) (*DomainTransactionID, error)
NewDomainTransactionIDFromByteSlice constructs a new TransactionID out of a byte slice Returns an error if the length of the byte slice is not exactly `DomainHashSize`
func NewDomainTransactionIDFromString ¶
func NewDomainTransactionIDFromString(transactionIDString string) (*DomainTransactionID, error)
NewDomainTransactionIDFromString constructs a new TransactionID out of a string Returns an error if the length of the string is not exactly `DomainHashSize * 2`
func (*DomainTransactionID) ByteArray ¶
func (id *DomainTransactionID) ByteArray() *[DomainHashSize]byte
ByteArray returns the bytes in this transactionID represented as a byte array. The transactionID bytes are cloned, therefore it is safe to modify the resulting array.
func (*DomainTransactionID) ByteSlice ¶
func (id *DomainTransactionID) ByteSlice() []byte
ByteSlice returns the bytes in this transactionID represented as a byte slice. The transactionID bytes are cloned, therefore it is safe to modify the resulting slice.
func (*DomainTransactionID) Clone ¶
func (id *DomainTransactionID) Clone() *DomainTransactionID
Clone returns a clone of DomainTransactionID
func (*DomainTransactionID) Equal ¶
func (id *DomainTransactionID) Equal(other *DomainTransactionID) bool
Equal returns whether id equals to other
func (*DomainTransactionID) Less ¶
func (id *DomainTransactionID) Less(other *DomainTransactionID) bool
Less returns true if id is less than other
func (*DomainTransactionID) LessOrEqual ¶
func (id *DomainTransactionID) LessOrEqual(other *DomainTransactionID) bool
LessOrEqual returns true if id is smaller or equal to other
func (DomainTransactionID) String ¶
func (id DomainTransactionID) String() string
String stringifies a transaction ID.
type DomainTransactionInput ¶
type DomainTransactionInput struct { PreviousOutpoint DomainOutpoint SignatureScript []byte Sequence uint64 SigOpCount byte UTXOEntry UTXOEntry }
DomainTransactionInput represents a Pyrin transaction input
func (*DomainTransactionInput) Clone ¶
func (input *DomainTransactionInput) Clone() *DomainTransactionInput
Clone returns a clone of DomainTransactionInput
func (*DomainTransactionInput) Equal ¶
func (input *DomainTransactionInput) Equal(other *DomainTransactionInput) bool
Equal returns whether input equals to other
type DomainTransactionOutput ¶
type DomainTransactionOutput struct { Value uint64 ScriptPublicKey *ScriptPublicKey }
DomainTransactionOutput represents a pyipad transaction output
func (*DomainTransactionOutput) Clone ¶
func (output *DomainTransactionOutput) Clone() *DomainTransactionOutput
Clone returns a clone of DomainTransactionOutput
func (*DomainTransactionOutput) Equal ¶
func (output *DomainTransactionOutput) Equal(other *DomainTransactionOutput) bool
Equal returns whether output equals to other
type MutableBlockHeader ¶
type MutableBlockHeader interface { BaseBlockHeader ToImmutable() BlockHeader SetNonce(nonce uint64) SetTimeInMilliseconds(timeInMilliseconds int64) SetHashMerkleRoot(hashMerkleRoot *DomainHash) }
MutableBlockHeader represents a block header that can be mutated, but only the fields that are relevant to mining (Nonce and TimeInMilliseconds).
type MutableUTXODiff ¶
type MutableUTXODiff interface { ToImmutable() UTXODiff WithDiff(other UTXODiff) (UTXODiff, error) DiffFrom(other UTXODiff) (UTXODiff, error) ToAdd() UTXOCollection ToRemove() UTXOCollection WithDiffInPlace(other UTXODiff) error AddTransaction(transaction *DomainTransaction, blockDAAScore uint64) error }
MutableUTXODiff represents a UTXO-Diff that can be mutated
type OutpointAndUTXOEntryPair ¶
type OutpointAndUTXOEntryPair struct { Outpoint *DomainOutpoint UTXOEntry UTXOEntry }
OutpointAndUTXOEntryPair is an outpoint along with its respective UTXO entry
type PruningPointProof ¶
type PruningPointProof struct {
Headers [][]BlockHeader
}
PruningPointProof is the data structure holding the pruning point proof
type ReadOnlyUTXOSetIterator ¶
type ReadOnlyUTXOSetIterator interface { First() bool Next() bool Get() (outpoint *DomainOutpoint, utxoEntry UTXOEntry, err error) Close() error }
ReadOnlyUTXOSetIterator is an iterator over all entries in a ReadOnlyUTXOSet
type ScriptPublicKey ¶
ScriptPublicKey represents a pyipad ScriptPublicKey
func NewScriptPublicKeyFromString ¶
func NewScriptPublicKeyFromString(ScriptPublicKeyString string) *ScriptPublicKey
NewScriptPublicKeyFromString converts the given string to a scriptPublicKey
func (*ScriptPublicKey) Equal ¶
func (spk *ScriptPublicKey) Equal(other *ScriptPublicKey) bool
Equal returns whether spk equals to other
func (*ScriptPublicKey) String ¶
func (spk *ScriptPublicKey) String() string
String stringifies a ScriptPublicKey.
type SelectedChainPath ¶
type SelectedChainPath struct { Added []*DomainHash Removed []*DomainHash }
SelectedChainPath is a path the of the selected chains between two blocks.
type TransactionAcceptanceData ¶
type TransactionAcceptanceData struct { Transaction *DomainTransaction Fee uint64 IsAccepted bool TransactionInputUTXOEntries []UTXOEntry }
TransactionAcceptanceData stores a transaction together with an indication if it was accepted or not by some block
func (*TransactionAcceptanceData) Clone ¶
func (tad *TransactionAcceptanceData) Clone() *TransactionAcceptanceData
Clone returns a clone of TransactionAcceptanceData
func (*TransactionAcceptanceData) Equal ¶
func (tad *TransactionAcceptanceData) Equal(other *TransactionAcceptanceData) bool
Equal returns whether tad equals to other
type TrustedDataDataDAAHeader ¶
type TrustedDataDataDAAHeader struct { Header BlockHeader GHOSTDAGData *BlockGHOSTDAGData }
TrustedDataDataDAAHeader is a block that belongs to BlockWithTrustedData.DAAWindow
type UTXOCollection ¶
type UTXOCollection interface { Iterator() ReadOnlyUTXOSetIterator Get(outpoint *DomainOutpoint) (UTXOEntry, bool) Contains(outpoint *DomainOutpoint) bool Len() int }
UTXOCollection represents a collection of UTXO entries, indexed by their outpoint
type UTXODiff ¶
type UTXODiff interface { ToAdd() UTXOCollection ToRemove() UTXOCollection WithDiff(other UTXODiff) (UTXODiff, error) DiffFrom(other UTXODiff) (UTXODiff, error) Reversed() UTXODiff CloneMutable() MutableUTXODiff }
UTXODiff represents the diff between two UTXO sets
type UTXOEntry ¶
type UTXOEntry interface { Amount() uint64 // Utxo amount in Leors ScriptPublicKey() *ScriptPublicKey // The public key script for the output. BlockDAAScore() uint64 // Daa score of the block accepting the tx. IsCoinbase() bool Equal(other UTXOEntry) bool }
UTXOEntry houses details about an individual transaction output in a utxo set such as whether or not it was contained in a coinbase tx, the daa score of the block that accepts the tx, its public key script, and how much it pays.
type VirtualChangeSet ¶
type VirtualChangeSet struct { VirtualSelectedParentChainChanges *SelectedChainPath VirtualUTXODiff UTXODiff VirtualParents []*DomainHash VirtualSelectedParentBlueScore uint64 VirtualDAAScore uint64 }
VirtualChangeSet is an event raised by consensus when virtual changes
type VirtualInfo ¶
type VirtualInfo struct { ParentHashes []*DomainHash Bits uint32 PastMedianTime int64 BlueScore uint64 DAAScore uint64 }
VirtualInfo represents information about the virtual block needed by external components
Source Files ¶
- acceptancedata.go
- block.go
- block_with_trusted_data.go
- blockinfo.go
- blocklevelparents.go
- blocklocator.go
- blockstatus.go
- blocktemplate.go
- coinbase.go
- consensus.go
- consensus_events.go
- ghostdag.go
- hash.go
- pruning_point_proof.go
- readonlyutxoset.go
- subnetworkid.go
- sync.go
- transaction.go
- utxodiff.go
- utxoentry.go
- virtual.go