Documentation ¶
Index ¶
- Constants
- func BlocksInPPLNSWindow(tip *SideBlock, consensus *sidechain.Consensus, ...) (bottomHeight uint64, err error)
- func BlocksInPPLNSWindowFast(indexDb *Index, tip *SideBlock, ...) (bottomHeight uint64, err error)
- func CalculateOutputs(indexDb *Index, block *SideBlock, transactionOutputType uint8, ...) (outputs transaction.Outputs, bottomHeight uint64)
- func ChanConsume[T any](c <-chan T)
- func ChanIterate[T any](c <-chan T, f IterateFunction[int, T]) (complete bool)
- func ChanToSlice[S ~[]T, T any](c <-chan T) (s S)
- func GetShares(indexDb *Index, tip *SideBlock, coinbasePrivateKeySeed types.Hash, ...) (shares sidechain.Shares, bottomHeight uint64)
- func GetSharesOrdered(indexDb *Index, tip *SideBlock, ...) (shares sidechain.Shares, bottomHeight uint64)
- func HashRatioSideBlocks(shares []*SideBlock, latest *SideBlock, consensusUnclePenalty uint64) (hashrate uint64, ratio float64, weight, total types.Difficulty)
- func IterateSideBlocksInPPLNSWindow(tip *SideBlock, consensus *sidechain.Consensus, ...) error
- func IterateSideBlocksInPPLNSWindowFast(indexDb *Index, tip *SideBlock, ...) error
- func IterateToSlice[T any](i Iterator[int, T], _ ...error) (s []T)
- func IterateToSliceWithoutPointer[T any](i Iterator[int, *T], _ ...error) (s []T)
- func QueryFirstResult[T any](i QueryIterator[T], err ...error) (v *T)
- func QueryHasResults[T any](i QueryIterator[T], err ...error) bool
- func QueryIterate[V any](i QueryIterator[V], f IterateFunction[int, *V])
- func QueryIterateToSlice[T any](i QueryIterator[T], err ...error) (s []*T)
- func SliceIterate[S ~[]T, T any](s S, f IterateFunction[int, T]) (complete bool)
- func SortSideBlock(a, b *SideBlock) int
- type BlockInclusion
- type FakeQueryResult
- type FoundBlock
- type GetByTemplateIdFunc
- type GetUnclesByTemplateIdFunc
- type Index
- func (i *Index) CachePoolBlock(b *sidechain.PoolBlock)
- func (i *Index) Close() error
- func (i *Index) Consensus() *sidechain.Consensus
- func (i *Index) DeleteMinerWebHook(minerId uint64, hookType WebHookType) error
- func (i *Index) DerivationCache() sidechain.DerivationCacheInterface
- func (i *Index) GetByTemplateId(id types.Hash) *sidechain.PoolBlock
- func (i *Index) GetDifficultyByHeight(height uint64) types.Difficulty
- func (i *Index) GetFoundBlocks(where string, limit uint64, params ...any) (QueryIterator[FoundBlock], error)
- func (i *Index) GetMainBlockByCoinbaseId(id types.Hash) (b *MainBlock)
- func (i *Index) GetMainBlockByGlobalOutputIndex(globalOutputIndex uint64) (b *MainBlock)
- func (i *Index) GetMainBlockByHeight(height uint64) (b *MainBlock)
- func (i *Index) GetMainBlockById(id types.Hash) (b *MainBlock)
- func (i *Index) GetMainBlockTip() (b *MainBlock)
- func (i *Index) GetMainBlocksByQuery(where string, params ...any) (QueryIterator[MainBlock], error)
- func (i *Index) GetMainBlocksByQueryStatement(stmt *sql.Stmt, params ...any) (QueryIterator[MainBlock], error)
- func (i *Index) GetMainCoinbaseOutputByGlobalOutputIndex(globalOutputIndex uint64) (o *MainCoinbaseOutput)
- func (i *Index) GetMainCoinbaseOutputByIndex(coinbaseId types.Hash, index uint64) (o *MainCoinbaseOutput)
- func (i *Index) GetMainCoinbaseOutputByMinerId(coinbaseId types.Hash, minerId uint64) *MainCoinbaseOutput
- func (i *Index) GetMainCoinbaseOutputs(coinbaseId types.Hash) (QueryIterator[MainCoinbaseOutput], error)
- func (i *Index) GetMainLikelySweepTransactionByGlobalOutputIndices(globalOutputIndices ...uint64) []*MainLikelySweepTransaction
- func (i *Index) GetMainLikelySweepTransactionBySpendingGlobalOutputIndices(globalOutputIndices ...uint64) [][]*MainLikelySweepTransaction
- func (i *Index) GetMainLikelySweepTransactions(limit uint64) (r QueryIterator[MainLikelySweepTransaction], err error)
- func (i *Index) GetMainLikelySweepTransactionsByAddress(addr *address.Address, limit uint64) (r QueryIterator[MainLikelySweepTransaction], err error)
- func (i *Index) GetMiner(miner uint64) *Miner
- func (i *Index) GetMinerByAddress(addr *address.Address) *Miner
- func (i *Index) GetMinerByAlias(alias string) *Miner
- func (i *Index) GetMinerByPackedAddress(addr address.PackedAddress) *Miner
- func (i *Index) GetMinerByStringAddress(addr string) *Miner
- func (i *Index) GetMinerWebHooks(minerId uint64) (QueryIterator[MinerWebHook], error)
- func (i *Index) GetOrCreateMinerByAddress(addr *address.Address) *Miner
- func (i *Index) GetOrCreateMinerPackedAddress(addr address.PackedAddress) *Miner
- func (i *Index) GetPayoutsByMinerId(minerId uint64, limit uint64) (r QueryIterator[Payout], err error)
- func (i *Index) GetPayoutsByMinerIdFromHeight(minerId uint64, height uint64) (QueryIterator[Payout], error)
- func (i *Index) GetPayoutsByMinerIdFromTimestamp(minerId uint64, timestamp uint64) (QueryIterator[Payout], error)
- func (i *Index) GetPayoutsBySideBlock(b *SideBlock) (QueryIterator[Payout], error)
- func (i *Index) GetSeedByHeight(height uint64) types.Hash
- func (i *Index) GetShares(limit, minerId uint64, onlyBlocks bool, inclusion BlockInclusion) (QueryIterator[SideBlock], error)
- func (i *Index) GetSideBlockByMainId(id types.Hash) (b *SideBlock)
- func (i *Index) GetSideBlockFromPoolBlock(b *sidechain.PoolBlock, inclusion BlockInclusion) (tip *SideBlock, uncles []*SideBlock, err error)
- func (i *Index) GetSideBlockTip() (b *SideBlock)
- func (i *Index) GetSideBlocksByHeight(height uint64) QueryIterator[SideBlock]
- func (i *Index) GetSideBlocksByMainHeight(height uint64) QueryIterator[SideBlock]
- func (i *Index) GetSideBlocksByMinerIdInWindow(minerId, startHeight, windowSize uint64) QueryIterator[SideBlock]
- func (i *Index) GetSideBlocksByQuery(where string, params ...any) (QueryIterator[SideBlock], error)
- func (i *Index) GetSideBlocksByQueryStatement(stmt *sql.Stmt, params ...any) (QueryIterator[SideBlock], error)
- func (i *Index) GetSideBlocksByTemplateId(id types.Hash) QueryIterator[SideBlock]
- func (i *Index) GetSideBlocksByUncleOfId(id types.Hash) QueryIterator[SideBlock]
- func (i *Index) GetSideBlocksInPPLNSWindow(tip *SideBlock) QueryIterator[SideBlock]
- func (i *Index) GetSideBlocksInWindow(startHeight, windowSize uint64) QueryIterator[SideBlock]
- func (i *Index) GetTipSideBlockByHeight(height uint64) (b *SideBlock)
- func (i *Index) GetTipSideBlockByTemplateId(id types.Hash) (b *SideBlock)
- func (i *Index) GetView(k string) string
- func (i *Index) InsertOrUpdateMainBlock(b *MainBlock) error
- func (i *Index) InsertOrUpdateMainCoinbaseOutputs(outputs MainCoinbaseOutputs) error
- func (i *Index) InsertOrUpdateMainLikelySweepTransaction(t *MainLikelySweepTransaction) error
- func (i *Index) InsertOrUpdateMinerWebHook(w *MinerWebHook) error
- func (i *Index) InsertOrUpdatePoolBlock(b *sidechain.PoolBlock, inclusion BlockInclusion) error
- func (i *Index) InsertOrUpdateSideBlock(b *SideBlock) error
- func (i *Index) PrepareMainBlocksByQueryStatement(where string) (stmt *sql.Stmt, err error)
- func (i *Index) PrepareSideBlocksByQueryStatement(where string) (stmt *sql.Stmt, err error)
- func (i *Index) Query(query string, callback func(row RowScanInterface) error, params ...any) error
- func (i *Index) QueryGlobalOutputIndices(indices []uint64) []*MatchedOutput
- func (i *Index) QueryStatement(stmt *sql.Stmt, callback func(row RowScanInterface) error, params ...any) error
- func (i *Index) QueryTransactionInputs(inputs []client.TransactionInput) TransactionInputQueryResults
- func (i *Index) SetMinerAlias(minerId uint64, alias string) error
- type IterateFunction
- type Iterator
- type IteratorFunction
- type MainBlock
- type MainCoinbaseOutput
- type MainCoinbaseOutputs
- type MainLikelySweepTransaction
- type MatchedOutput
- type Miner
- type MinerWebHook
- type MinimalMatchedOutput
- type MinimalTransactionInputQueryResult
- type MinimalTransactionInputQueryResults
- type Payout
- type QueryIterator
- type QueryResult
- type RowScanInterface
- type Scannable
- type SideBlock
- func (b *SideBlock) FromPoolBlock(i *Index, block *sidechain.PoolBlock, ...) error
- func (b *SideBlock) FullId() sidechain.FullId
- func (b *SideBlock) IsOrphan() bool
- func (b *SideBlock) IsTipOfHeight() bool
- func (b *SideBlock) IsUncle() bool
- func (b *SideBlock) ScanFromRow(_ *sidechain.Consensus, row RowScanInterface) error
- func (b *SideBlock) SetUncleOf(block *SideBlock) error
- func (b *SideBlock) Weight(tipHeight, windowSize, consensusUnclePenalty uint64) (weight, parentWeight uint64)
- type SideBlockUncleEntry
- type SideBlockWindowAddWeightFunc
- type SideBlockWindowSlot
- type TransactionInputQueryResult
- type TransactionInputQueryResults
- type TransactionInputQueryResultsMatch
- type TransactionInputQueryResultsMatches
- type WebHookType
Constants ¶
View Source
const ( // InclusionOrphan orphan (was not included in-verified-chain) InclusionOrphan = BlockInclusion(iota) // InclusionInVerifiedChain in-verified-chain (uncle or main) InclusionInVerifiedChain // InclusionAlternateInVerifiedChain alternate in-verified-chain (uncle or main), for example when duplicate nonce happens InclusionAlternateInVerifiedChain InclusionCount )
View Source
const MainBlockSelectFields = "id, height, timestamp, reward, coinbase_id, difficulty, metadata, side_template_id, coinbase_private_key"
View Source
const MainCoinbaseOutputSelectFields = "id, index, global_output_index, miner, value"
View Source
const MainLikelySweepTransactionSelectFields = "" /* 260-byte string literal not displayed */
View Source
const MinerSelectFields = "id, alias, spend_public_key, view_public_key"
View Source
const SideBlockSelectFields = "" /* 284-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func BlocksInPPLNSWindow ¶
func BlocksInPPLNSWindow(tip *SideBlock, consensus *sidechain.Consensus, difficultyByHeight block.GetDifficultyByHeightFunc, getByTemplateId GetByTemplateIdFunc, getUnclesByTemplateId GetUnclesByTemplateIdFunc, addWeightFunc SideBlockWindowAddWeightFunc) (bottomHeight uint64, err error)
BlocksInPPLNSWindow Copy of sidechain.BlocksInPPLNSWindow
func BlocksInPPLNSWindowFast ¶
func BlocksInPPLNSWindowFast(indexDb *Index, tip *SideBlock, difficultyByHeight block.GetDifficultyByHeightFunc, addWeightFunc SideBlockWindowAddWeightFunc) (bottomHeight uint64, err error)
func CalculateOutputs ¶
func CalculateOutputs(indexDb *Index, block *SideBlock, transactionOutputType uint8, totalReward uint64, coinbasePrivateKey crypto.PrivateKey, coinbasePrivateKeySeed types.Hash, difficultyByHeight block.GetDifficultyByHeightFunc, getByTemplateId GetByTemplateIdFunc, getUnclesByTemplateId GetUnclesByTemplateIdFunc, derivationCache sidechain.DerivationCacheInterface, preAllocatedShares sidechain.Shares, preAllocatedRewards []uint64) (outputs transaction.Outputs, bottomHeight uint64)
CalculateOutputs Copy of sidechain.CalculateOutputs
func ChanConsume ¶
func ChanConsume[T any](c <-chan T)
func ChanIterate ¶
func ChanIterate[T any](c <-chan T, f IterateFunction[int, T]) (complete bool)
func ChanToSlice ¶
func ChanToSlice[S ~[]T, T any](c <-chan T) (s S)
func GetShares ¶
func GetShares(indexDb *Index, tip *SideBlock, coinbasePrivateKeySeed types.Hash, difficultyByHeight block.GetDifficultyByHeightFunc, getByTemplateId GetByTemplateIdFunc, getUnclesByTemplateId GetUnclesByTemplateIdFunc, preAllocatedShares sidechain.Shares) (shares sidechain.Shares, bottomHeight uint64)
GetShares Copy of sidechain.GetShares
func GetSharesOrdered ¶
func GetSharesOrdered(indexDb *Index, tip *SideBlock, difficultyByHeight block.GetDifficultyByHeightFunc, getByTemplateId GetByTemplateIdFunc, getUnclesByTemplateId GetUnclesByTemplateIdFunc, preAllocatedShares sidechain.Shares) (shares sidechain.Shares, bottomHeight uint64)
GetSharesOrdered Copy of sidechain.GetSharesOrdered
func HashRatioSideBlocks ¶
func IterateSideBlocksInPPLNSWindow ¶
func IterateSideBlocksInPPLNSWindow(tip *SideBlock, consensus *sidechain.Consensus, difficultyByHeight block.GetDifficultyByHeightFunc, getByTemplateId GetByTemplateIdFunc, getUnclesByTemplateId GetUnclesByTemplateIdFunc, addWeightFunc SideBlockWindowAddWeightFunc, slotFunc func(slot SideBlockWindowSlot)) error
IterateSideBlocksInPPLNSWindow Copy of sidechain.IterateBlocksInPPLNSWindow
func IterateSideBlocksInPPLNSWindowFast ¶
func IterateSideBlocksInPPLNSWindowFast(indexDb *Index, tip *SideBlock, difficultyByHeight block.GetDifficultyByHeightFunc, addWeightFunc SideBlockWindowAddWeightFunc, slotFunc func(slot SideBlockWindowSlot)) error
func QueryFirstResult ¶
func QueryFirstResult[T any](i QueryIterator[T], err ...error) (v *T)
func QueryHasResults ¶
func QueryHasResults[T any](i QueryIterator[T], err ...error) bool
func QueryIterate ¶
func QueryIterate[V any](i QueryIterator[V], f IterateFunction[int, *V])
func QueryIterateToSlice ¶
func QueryIterateToSlice[T any](i QueryIterator[T], err ...error) (s []*T)
func SliceIterate ¶
func SliceIterate[S ~[]T, T any](s S, f IterateFunction[int, T]) (complete bool)
func SortSideBlock ¶
Types ¶
type BlockInclusion ¶
type BlockInclusion int
type FakeQueryResult ¶
func (*FakeQueryResult[V]) All ¶
func (r *FakeQueryResult[V]) All(f IterateFunction[int, *V]) (complete bool)
func (*FakeQueryResult[V]) Close ¶
func (r *FakeQueryResult[V]) Close()
func (*FakeQueryResult[V]) Err ¶
func (r *FakeQueryResult[V]) Err() error
func (*FakeQueryResult[V]) Next ¶
func (r *FakeQueryResult[V]) Next() (int, *V)
type FoundBlock ¶
type FoundBlock struct { MainBlock MainBlock `json:"main_block"` SideHeight uint64 `json:"side_height"` Miner uint64 `json:"miner"` UncleOf types.Hash `json:"uncle_of,omitempty"` EffectiveHeight uint64 `json:"effective_height"` WindowDepth uint32 `json:"window_depth"` WindowOutputs uint32 `json:"window_outputs"` TransactionCount uint32 `json:"transaction_count"` Difficulty uint64 `json:"difficulty"` CumulativeDifficulty types.Difficulty `json:"cumulative_difficulty"` Inclusion BlockInclusion `json:"inclusion"` // Extra information filled just for JSON purposes MinerAddress *address.Address `json:"miner_address,omitempty"` MinerAlias string `json:"miner_alias,omitempty"` }
func (*FoundBlock) ScanFromRow ¶
func (b *FoundBlock) ScanFromRow(_ *sidechain.Consensus, row RowScanInterface) error
type GetByTemplateIdFunc ¶
type GetUnclesByTemplateIdFunc ¶
type GetUnclesByTemplateIdFunc func(h types.Hash) QueryIterator[SideBlock]
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func OpenIndex ¶
func OpenIndex(connStr string, consensus *sidechain.Consensus, difficultyByHeight block.GetDifficultyByHeightFunc, getSeedByHeight block.GetSeedByHeightFunc, getByTemplateId sidechain.GetByTemplateIdFunc) (index *Index, err error)
func (*Index) CachePoolBlock ¶
func (*Index) DeleteMinerWebHook ¶
func (i *Index) DeleteMinerWebHook(minerId uint64, hookType WebHookType) error
func (*Index) DerivationCache ¶
func (i *Index) DerivationCache() sidechain.DerivationCacheInterface
func (*Index) GetDifficultyByHeight ¶
func (i *Index) GetDifficultyByHeight(height uint64) types.Difficulty
func (*Index) GetFoundBlocks ¶
func (i *Index) GetFoundBlocks(where string, limit uint64, params ...any) (QueryIterator[FoundBlock], error)
func (*Index) GetMainBlockByCoinbaseId ¶
func (*Index) GetMainBlockByGlobalOutputIndex ¶
func (*Index) GetMainBlockByHeight ¶
func (*Index) GetMainBlockTip ¶
func (*Index) GetMainBlocksByQuery ¶
func (*Index) GetMainBlocksByQueryStatement ¶
func (*Index) GetMainCoinbaseOutputByGlobalOutputIndex ¶
func (i *Index) GetMainCoinbaseOutputByGlobalOutputIndex(globalOutputIndex uint64) (o *MainCoinbaseOutput)
func (*Index) GetMainCoinbaseOutputByIndex ¶
func (i *Index) GetMainCoinbaseOutputByIndex(coinbaseId types.Hash, index uint64) (o *MainCoinbaseOutput)
func (*Index) GetMainCoinbaseOutputByMinerId ¶
func (i *Index) GetMainCoinbaseOutputByMinerId(coinbaseId types.Hash, minerId uint64) *MainCoinbaseOutput
func (*Index) GetMainCoinbaseOutputs ¶
func (i *Index) GetMainCoinbaseOutputs(coinbaseId types.Hash) (QueryIterator[MainCoinbaseOutput], error)
func (*Index) GetMainLikelySweepTransactionByGlobalOutputIndices ¶
func (i *Index) GetMainLikelySweepTransactionByGlobalOutputIndices(globalOutputIndices ...uint64) []*MainLikelySweepTransaction
func (*Index) GetMainLikelySweepTransactionBySpendingGlobalOutputIndices ¶
func (i *Index) GetMainLikelySweepTransactionBySpendingGlobalOutputIndices(globalOutputIndices ...uint64) [][]*MainLikelySweepTransaction
func (*Index) GetMainLikelySweepTransactions ¶
func (i *Index) GetMainLikelySweepTransactions(limit uint64) (r QueryIterator[MainLikelySweepTransaction], err error)
func (*Index) GetMainLikelySweepTransactionsByAddress ¶
func (i *Index) GetMainLikelySweepTransactionsByAddress(addr *address.Address, limit uint64) (r QueryIterator[MainLikelySweepTransaction], err error)
func (*Index) GetMinerByAlias ¶
func (*Index) GetMinerByPackedAddress ¶
func (i *Index) GetMinerByPackedAddress(addr address.PackedAddress) *Miner
func (*Index) GetMinerByStringAddress ¶
func (*Index) GetMinerWebHooks ¶
func (i *Index) GetMinerWebHooks(minerId uint64) (QueryIterator[MinerWebHook], error)
func (*Index) GetOrCreateMinerByAddress ¶
func (*Index) GetOrCreateMinerPackedAddress ¶
func (i *Index) GetOrCreateMinerPackedAddress(addr address.PackedAddress) *Miner
func (*Index) GetPayoutsByMinerId ¶
func (*Index) GetPayoutsByMinerIdFromHeight ¶
func (*Index) GetPayoutsByMinerIdFromTimestamp ¶
func (*Index) GetPayoutsBySideBlock ¶
func (i *Index) GetPayoutsBySideBlock(b *SideBlock) (QueryIterator[Payout], error)
func (*Index) GetShares ¶
func (i *Index) GetShares(limit, minerId uint64, onlyBlocks bool, inclusion BlockInclusion) (QueryIterator[SideBlock], error)
func (*Index) GetSideBlockByMainId ¶
func (*Index) GetSideBlockFromPoolBlock ¶
func (*Index) GetSideBlockTip ¶
func (*Index) GetSideBlocksByHeight ¶
func (i *Index) GetSideBlocksByHeight(height uint64) QueryIterator[SideBlock]
func (*Index) GetSideBlocksByMainHeight ¶
func (i *Index) GetSideBlocksByMainHeight(height uint64) QueryIterator[SideBlock]
func (*Index) GetSideBlocksByMinerIdInWindow ¶
func (i *Index) GetSideBlocksByMinerIdInWindow(minerId, startHeight, windowSize uint64) QueryIterator[SideBlock]
func (*Index) GetSideBlocksByQuery ¶
func (*Index) GetSideBlocksByQueryStatement ¶
func (*Index) GetSideBlocksByTemplateId ¶
func (i *Index) GetSideBlocksByTemplateId(id types.Hash) QueryIterator[SideBlock]
func (*Index) GetSideBlocksByUncleOfId ¶
func (i *Index) GetSideBlocksByUncleOfId(id types.Hash) QueryIterator[SideBlock]
func (*Index) GetSideBlocksInPPLNSWindow ¶
func (i *Index) GetSideBlocksInPPLNSWindow(tip *SideBlock) QueryIterator[SideBlock]
func (*Index) GetSideBlocksInWindow ¶
func (i *Index) GetSideBlocksInWindow(startHeight, windowSize uint64) QueryIterator[SideBlock]
func (*Index) GetTipSideBlockByHeight ¶
func (*Index) GetTipSideBlockByTemplateId ¶
func (*Index) InsertOrUpdateMainBlock ¶
func (*Index) InsertOrUpdateMainCoinbaseOutputs ¶
func (i *Index) InsertOrUpdateMainCoinbaseOutputs(outputs MainCoinbaseOutputs) error
func (*Index) InsertOrUpdateMainLikelySweepTransaction ¶
func (i *Index) InsertOrUpdateMainLikelySweepTransaction(t *MainLikelySweepTransaction) error
func (*Index) InsertOrUpdateMinerWebHook ¶
func (i *Index) InsertOrUpdateMinerWebHook(w *MinerWebHook) error
func (*Index) InsertOrUpdatePoolBlock ¶
func (i *Index) InsertOrUpdatePoolBlock(b *sidechain.PoolBlock, inclusion BlockInclusion) error
func (*Index) InsertOrUpdateSideBlock ¶
func (*Index) PrepareMainBlocksByQueryStatement ¶
func (*Index) PrepareSideBlocksByQueryStatement ¶
func (*Index) QueryGlobalOutputIndices ¶
func (i *Index) QueryGlobalOutputIndices(indices []uint64) []*MatchedOutput
func (*Index) QueryStatement ¶
func (*Index) QueryTransactionInputs ¶
func (i *Index) QueryTransactionInputs(inputs []client.TransactionInput) TransactionInputQueryResults
type IterateFunction ¶
type Iterator ¶
type Iterator[K, V any] interface { All(f IterateFunction[K, V]) (complete bool) }
type IteratorFunction ¶
type IteratorFunction[K, V any] func(f IterateFunction[K, V]) (complete bool)
type MainBlock ¶
type MainBlock struct { Id types.Hash `json:"id"` Height uint64 `json:"height"` Timestamp uint64 `json:"timestamp"` Reward uint64 `json:"reward"` CoinbaseId types.Hash `json:"coinbase_id"` Difficulty uint64 `json:"difficulty"` // Metadata should be jsonb blob, can be NULL. metadata such as pool ownership, links to other p2pool networks, and other interesting data Metadata map[string]any `json:"metadata,omitempty"` // sidechain data for blocks we own // SideTemplateId can be NULL SideTemplateId types.Hash `json:"side_template_id,omitempty"` // CoinbasePrivateKey private key for coinbase outputs we own (all 0x00 = not known, but should have one) CoinbasePrivateKey crypto.PrivateKeyBytes `json:"coinbase_private_key,omitempty"` }
func (*MainBlock) GetMetadata ¶
func (*MainBlock) ScanFromRow ¶
func (b *MainBlock) ScanFromRow(_ *sidechain.Consensus, row RowScanInterface) error
func (*MainBlock) SetMetadata ¶
type MainCoinbaseOutput ¶
type MainCoinbaseOutput struct { // Id coinbase id Id types.Hash `json:"id"` // Index transaction output index Index uint32 `json:"index"` // Monero global output idx GlobalOutputIndex uint64 `json:"global_output_index"` // Miner owner of the output Miner uint64 `json:"miner"` Value uint64 `json:"value"` MinerAddress *address.Address `json:"miner_address,omitempty"` MinerAlias string `json:"miner_alias,omitempty"` }
func (*MainCoinbaseOutput) ScanFromRow ¶
func (o *MainCoinbaseOutput) ScanFromRow(_ *sidechain.Consensus, row RowScanInterface) error
type MainCoinbaseOutputs ¶
type MainCoinbaseOutputs []MainCoinbaseOutput
type MainLikelySweepTransaction ¶
type MainLikelySweepTransaction struct { // Id coinbase id Id types.Hash `json:"id"` Timestamp uint64 `json:"timestamp"` Result MinimalTransactionInputQueryResults `json:"result"` Match []TransactionInputQueryResultsMatch `json:"match"` Value uint64 `json:"value"` SpendingOutputIndices []uint64 `json:"spending_output_indices"` GlobalOutputIndices []uint64 `json:"global_output_indices"` InputCount int `json:"input_count"` InputDecoyCount int `json:"input_decoy_count"` MinerCount int `json:"miner_count"` OtherMinersCount int `json:"other_miners_count"` NoMinerCount int `json:"no_miner_count"` MinerRatio float32 `json:"miner_ratio"` OtherMinersRatio float32 `json:"other_miners_ratio"` NoMinerRatio float32 `json:"no_miner_ratio"` Address *address.Address `json:"address"` }
func (*MainLikelySweepTransaction) ScanFromRow ¶
func (t *MainLikelySweepTransaction) ScanFromRow(consensus *sidechain.Consensus, row RowScanInterface) error
type MatchedOutput ¶
type MatchedOutput struct { Coinbase *MainCoinbaseOutput `json:"coinbase,omitempty"` Sweep *MainLikelySweepTransaction `json:"sweep,omitempty"` GlobalOutputIndex uint64 `json:"global_output_index"` Timestamp uint64 `json:"timestamp"` Address *address.Address `json:"address"` }
type Miner ¶
type Miner struct {
// contains filtered or unexported fields
}
func (*Miner) ScanFromRow ¶
func (m *Miner) ScanFromRow(consensus *sidechain.Consensus, row RowScanInterface) error
type MinerWebHook ¶
type MinerWebHook struct { Miner uint64 `json:"miner"` Type WebHookType `json:"type"` Url string `json:"url"` Settings map[string]string `json:"settings"` Consensus *sidechain.Consensus `json:"-"` }
func (*MinerWebHook) ScanFromRow ¶
func (w *MinerWebHook) ScanFromRow(consensus *sidechain.Consensus, row RowScanInterface) error
func (*MinerWebHook) Verify ¶
func (w *MinerWebHook) Verify() error
type MinimalMatchedOutput ¶
type MinimalTransactionInputQueryResult ¶
type MinimalTransactionInputQueryResult struct { Input client.TransactionInput `json:"input"` MatchedOutputs []*MinimalMatchedOutput `json:"matched_outputs"` }
type MinimalTransactionInputQueryResults ¶
type MinimalTransactionInputQueryResults []MinimalTransactionInputQueryResult
type Payout ¶
type Payout struct { Miner uint64 `json:"miner"` TemplateId types.Hash `json:"template_id"` SideHeight uint64 `json:"side_height"` UncleOf types.Hash `json:"uncle_of,omitempty"` MainId types.Hash `json:"main_id"` MainHeight uint64 `json:"main_height"` Timestamp uint64 `json:"timestamp"` CoinbaseId types.Hash `json:"coinbase_id"` Reward uint64 `json:"coinbase_reward"` PrivateKey crypto.PrivateKeyBytes `json:"coinbase_private_key"` Index uint64 `json:"coinbase_output_index"` GlobalOutputIndex uint64 `json:"global_output_index"` IncludingHeight uint64 `json:"including_height"` }
func (*Payout) ScanFromRow ¶
func (p *Payout) ScanFromRow(_ *sidechain.Consensus, row RowScanInterface) error
type QueryIterator ¶
type QueryResult ¶
type QueryResult[V any] struct { // contains filtered or unexported fields }
func (*QueryResult[V]) All ¶
func (r *QueryResult[V]) All(f IterateFunction[int, *V]) (complete bool)
func (*QueryResult[V]) Close ¶
func (r *QueryResult[V]) Close()
func (*QueryResult[V]) Err ¶
func (r *QueryResult[V]) Err() error
func (*QueryResult[V]) Next ¶
func (r *QueryResult[V]) Next() (int, *V)
type RowScanInterface ¶
type Scannable ¶
type Scannable interface {
ScanFromRow(consensus *sidechain.Consensus, row RowScanInterface) error
}
type SideBlock ¶
type SideBlock struct { // MainId mainchain id, on Monero network MainId types.Hash `json:"main_id"` MainHeight uint64 `json:"main_height"` // TemplateId -- sidechain template id. Note multiple blocks can exist per template id, see Inclusion TemplateId types.Hash `json:"template_id"` SideHeight uint64 `json:"side_height"` // ParentTemplateId previous sidechain template id ParentTemplateId types.Hash `json:"parent_template_id"` // Miner internal id of the miner who contributed the block Miner uint64 `json:"miner"` // UncleOf has been included under this parent block TemplateId as an uncle UncleOf types.Hash `json:"uncle_of,omitempty"` // EffectiveHeight has been included under this parent block height as an uncle, or is this height EffectiveHeight uint64 `json:"effective_height"` // Nonce data Nonce uint32 `json:"nonce"` ExtraNonce uint32 `json:"extra_nonce"` Timestamp uint64 `json:"timestamp"` SoftwareId p2pooltypes.SoftwareId `json:"software_id"` SoftwareVersion p2pooltypes.SoftwareVersion `json:"software_version"` // WindowDepth PPLNS window depth, in blocks including this one WindowDepth uint32 `json:"window_depth"` WindowOutputs uint32 `json:"window_outputs"` // Difficulty sidechain difficulty at height Difficulty uint64 `json:"difficulty"` CumulativeDifficulty types.Difficulty `json:"cumulative_difficulty"` PowDifficulty uint64 `json:"pow_difficulty"` // PowHash result of PoW function as a hash (all 0x00 = not known) PowHash types.Hash `json:"pow_hash"` Inclusion BlockInclusion `json:"inclusion"` TransactionCount uint32 `json:"transaction_count"` MinedMainAtHeight bool `json:"mined_main_at_height,omitempty"` MinerAddress *address.Address `json:"miner_address,omitempty"` MinerAlias string `json:"miner_alias,omitempty"` Uncles []SideBlockUncleEntry `json:"uncles,omitempty"` MainDifficulty uint64 `json:"main_difficulty,omitempty"` }
func (*SideBlock) FromPoolBlock ¶
func (b *SideBlock) FromPoolBlock(i *Index, block *sidechain.PoolBlock, getSeedByHeight mainblock.GetSeedByHeightFunc) error
FromPoolBlock block needs to be pre-processed for ids to be correct These fields need to be filled by caller to match needs: SideBlock.UncleOf SideBlock.EffectiveHeight SideBlock.WindowDepth SideBlock.Inclusion
func (*SideBlock) IsTipOfHeight ¶
IsTipOfHeight whether this block is considered to be the "main" block within this height, not an uncle, or alternate
func (*SideBlock) ScanFromRow ¶
func (b *SideBlock) ScanFromRow(_ *sidechain.Consensus, row RowScanInterface) error
func (*SideBlock) SetUncleOf ¶
type SideBlockUncleEntry ¶
type SideBlockWindowAddWeightFunc ¶
type SideBlockWindowAddWeightFunc func(b *SideBlock, weight types.Difficulty)
type SideBlockWindowSlot ¶
type TransactionInputQueryResult ¶
type TransactionInputQueryResult struct { Input client.TransactionInput `json:"input"` MatchedOutputs []*MatchedOutput `json:"matched_outputs"` }
type TransactionInputQueryResults ¶
type TransactionInputQueryResults []TransactionInputQueryResult
func (TransactionInputQueryResults) Match ¶
func (r TransactionInputQueryResults) Match() (result TransactionInputQueryResultsMatches)
type TransactionInputQueryResultsMatches ¶
type TransactionInputQueryResultsMatches []TransactionInputQueryResultsMatch
type WebHookType ¶
type WebHookType string
const ( WebHookSlack WebHookType = "slack" WebHookDiscord WebHookType = "discord" WebHookTelegram WebHookType = "telegram" WebHookMatrixHookshot WebHookType = "matrix-hookshot" WebHookCustom WebHookType = "custom" )
Click to show internal directories.
Click to hide internal directories.