rpccontext

package
v0.12.10-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: ISC Imports: 22 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildBlockVerboseDataInvalidBlock = errors.New("ErrBuildBlockVerboseDataInvalidBlock")

ErrBuildBlockVerboseDataInvalidBlock indicates that a block that was given to BuildBlockVerboseData is invalid.

Functions

func ConvertUTXOOutpointEntryPairsToUTXOsByAddressesEntries

func ConvertUTXOOutpointEntryPairsToUTXOsByAddressesEntries(address string, pairs utxoindex.UTXOOutpointEntryPairs) []*appmessage.UTXOsByAddressesEntry

ConvertUTXOOutpointEntryPairsToUTXOsByAddressesEntries converts UTXOOutpointEntryPairs to a slice of UTXOsByAddressesEntry

Types

type Context

type Context struct {
	Config            *config.Config
	NetAdapter        *netadapter.NetAdapter
	Domain            domain.Domain
	ProtocolManager   *protocol.Manager
	ConnectionManager *connmanager.ConnectionManager
	AddressManager    *addressmanager.AddressManager
	UTXOIndex         *utxoindex.UTXOIndex
	ShutDownChan      chan<- struct{}

	NotificationManager *NotificationManager
}

Context represents the RPC context

func NewContext

func NewContext(cfg *config.Config,
	domain domain.Domain,
	netAdapter *netadapter.NetAdapter,
	protocolManager *protocol.Manager,
	connectionManager *connmanager.ConnectionManager,
	addressManager *addressmanager.AddressManager,
	utxoIndex *utxoindex.UTXOIndex,
	shutDownChan chan<- struct{}) *Context

NewContext creates a new RPC context

func (*Context) ConvertAddressStringsToUTXOsChangedNotificationAddresses added in v0.8.9

func (ctx *Context) ConvertAddressStringsToUTXOsChangedNotificationAddresses(
	addressStrings []string) ([]*UTXOsChangedNotificationAddress, error)

ConvertAddressStringsToUTXOsChangedNotificationAddresses converts address strings to UTXOsChangedNotificationAddresses

func (*Context) ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage

func (ctx *Context) ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage(
	selectedParentChainChanges *externalapi.SelectedChainPath, includeAcceptedTransactionIDs bool) (
	*appmessage.VirtualSelectedParentChainChangedNotificationMessage, error)

ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage converts VirtualSelectedParentChainChanges to VirtualSelectedParentChainChangedNotificationMessage

func (*Context) GetDifficultyRatio

func (ctx *Context) GetDifficultyRatio(bits uint32, params *dagconfig.Params) float64

GetDifficultyRatio returns the proof-of-work difficulty as a multiple of the minimum difficulty using the passed bits field from the header of a block.

func (*Context) PopulateBlockWithVerboseData added in v0.10.0

func (ctx *Context) PopulateBlockWithVerboseData(block *appmessage.RPCBlock, domainBlockHeader externalapi.BlockHeader,
	domainBlock *externalapi.DomainBlock, includeTransactionVerboseData bool) error

PopulateBlockWithVerboseData populates the given `block` with verbose data from `domainBlockHeader` and optionally from `domainBlock`

func (*Context) PopulateTransactionWithVerboseData added in v0.10.0

func (ctx *Context) PopulateTransactionWithVerboseData(
	transaction *appmessage.RPCTransaction, domainBlockHeader externalapi.BlockHeader) error

PopulateTransactionWithVerboseData populates the given `transaction` with verbose data from `domainTransaction`

type NotificationListener

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

NotificationListener represents a registered RPC notification listener

func (*NotificationListener) IncludeAcceptedTransactionIDsInVirtualSelectedParentChainChangedNotifications added in v0.12.1

func (nl *NotificationListener) IncludeAcceptedTransactionIDsInVirtualSelectedParentChainChangedNotifications() bool

IncludeAcceptedTransactionIDsInVirtualSelectedParentChainChangedNotifications returns true if this listener includes accepted transaction IDs in it's virtual-selected-parent-chain-changed notifications

func (*NotificationListener) PropagateBlockAddedNotifications

func (nl *NotificationListener) PropagateBlockAddedNotifications()

PropagateBlockAddedNotifications instructs the listener to send block added notifications to the remote listener

func (*NotificationListener) PropagateFinalityConflictNotifications

func (nl *NotificationListener) PropagateFinalityConflictNotifications()

PropagateFinalityConflictNotifications instructs the listener to send finality conflict notifications to the remote listener

func (*NotificationListener) PropagateFinalityConflictResolvedNotifications

func (nl *NotificationListener) PropagateFinalityConflictResolvedNotifications()

PropagateFinalityConflictResolvedNotifications instructs the listener to send finality conflict resolved notifications to the remote listener

func (*NotificationListener) PropagateNewBlockTemplateNotifications added in v0.11.15

func (nl *NotificationListener) PropagateNewBlockTemplateNotifications()

PropagateNewBlockTemplateNotifications instructs the listener to send new block template notifications to the remote listener

func (*NotificationListener) PropagatePruningPointUTXOSetOverrideNotifications added in v0.8.10

func (nl *NotificationListener) PropagatePruningPointUTXOSetOverrideNotifications()

PropagatePruningPointUTXOSetOverrideNotifications instructs the listener to send pruning point UTXO set override notifications to the remote listener.

func (*NotificationListener) PropagateVirtualDaaScoreChangedNotifications added in v0.10.3

func (nl *NotificationListener) PropagateVirtualDaaScoreChangedNotifications()

PropagateVirtualDaaScoreChangedNotifications instructs the listener to send virtual DAA score notifications to the remote listener

func (*NotificationListener) PropagateVirtualSelectedParentBlueScoreChangedNotifications

func (nl *NotificationListener) PropagateVirtualSelectedParentBlueScoreChangedNotifications()

PropagateVirtualSelectedParentBlueScoreChangedNotifications instructs the listener to send virtual selected parent blue score notifications to the remote listener

func (*NotificationListener) PropagateVirtualSelectedParentChainChangedNotifications

func (nl *NotificationListener) PropagateVirtualSelectedParentChainChangedNotifications(includeAcceptedTransactionIDs bool)

PropagateVirtualSelectedParentChainChangedNotifications instructs the listener to send chain changed notifications to the remote listener

func (*NotificationListener) StopPropagatingPruningPointUTXOSetOverrideNotifications added in v0.8.10

func (nl *NotificationListener) StopPropagatingPruningPointUTXOSetOverrideNotifications()

StopPropagatingPruningPointUTXOSetOverrideNotifications instructs the listener to stop sending pruning point UTXO set override notifications to the remote listener.

type NotificationManager

type NotificationManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NotificationManager manages notifications for the RPC

func NewNotificationManager

func NewNotificationManager(params *dagconfig.Params) *NotificationManager

NewNotificationManager creates a new NotificationManager

func (*NotificationManager) AddListener

func (nm *NotificationManager) AddListener(router *routerpkg.Router)

AddListener registers a listener with the given router

func (*NotificationManager) HasBlockAddedListeners added in v0.12.1

func (nm *NotificationManager) HasBlockAddedListeners() bool

HasBlockAddedListeners indicates if the notification manager has any listeners for `BlockAdded` events

func (*NotificationManager) HasListenersThatPropagateVirtualSelectedParentChainChanged added in v0.12.5

func (nm *NotificationManager) HasListenersThatPropagateVirtualSelectedParentChainChanged() (hasListeners, hasListenersThatRequireAcceptedTransactionIDs bool)

HasListenersThatPropagateVirtualSelectedParentChainChanged returns whether there's any listener that is subscribed to VirtualSelectedParentChainChanged notifications as well as checks if any such listener requested to include AcceptedTransactionIDs.

func (*NotificationManager) Listener

Listener retrieves the listener registered with the given router

func (*NotificationManager) NotifyBlockAdded

func (nm *NotificationManager) NotifyBlockAdded(notification *appmessage.BlockAddedNotificationMessage) error

NotifyBlockAdded notifies the notification manager that a block has been added to the DAG

func (*NotificationManager) NotifyFinalityConflict

func (nm *NotificationManager) NotifyFinalityConflict(notification *appmessage.FinalityConflictNotificationMessage) error

NotifyFinalityConflict notifies the notification manager that there's a finality conflict in the DAG

func (*NotificationManager) NotifyFinalityConflictResolved

func (nm *NotificationManager) NotifyFinalityConflictResolved(notification *appmessage.FinalityConflictResolvedNotificationMessage) error

NotifyFinalityConflictResolved notifies the notification manager that a finality conflict in the DAG has been resolved

func (*NotificationManager) NotifyNewBlockTemplate added in v0.11.15

func (nm *NotificationManager) NotifyNewBlockTemplate(
	notification *appmessage.NewBlockTemplateNotificationMessage) error

NotifyNewBlockTemplate notifies the notification manager that a new block template is available for miners

func (*NotificationManager) NotifyPruningPointUTXOSetOverride added in v0.8.10

func (nm *NotificationManager) NotifyPruningPointUTXOSetOverride() error

NotifyPruningPointUTXOSetOverride notifies the notification manager that the UTXO index reset due to pruning point change via IBD.

func (*NotificationManager) NotifyUTXOsChanged

func (nm *NotificationManager) NotifyUTXOsChanged(utxoChanges *utxoindex.UTXOChanges) error

NotifyUTXOsChanged notifies the notification manager that UTXOs have been changed

func (*NotificationManager) NotifyVirtualDaaScoreChanged added in v0.10.3

func (nm *NotificationManager) NotifyVirtualDaaScoreChanged(
	notification *appmessage.VirtualDaaScoreChangedNotificationMessage) error

NotifyVirtualDaaScoreChanged notifies the notification manager that the DAG's virtual DAA score has changed

func (*NotificationManager) NotifyVirtualSelectedParentBlueScoreChanged

func (nm *NotificationManager) NotifyVirtualSelectedParentBlueScoreChanged(
	notification *appmessage.VirtualSelectedParentBlueScoreChangedNotificationMessage) error

NotifyVirtualSelectedParentBlueScoreChanged notifies the notification manager that the DAG's virtual selected parent blue score has changed

func (*NotificationManager) NotifyVirtualSelectedParentChainChanged

func (nm *NotificationManager) NotifyVirtualSelectedParentChainChanged(
	notification *appmessage.VirtualSelectedParentChainChangedNotificationMessage) error

NotifyVirtualSelectedParentChainChanged notifies the notification manager that the DAG's selected parent chain has changed

func (*NotificationManager) PropagateUTXOsChangedNotifications added in v0.12.5

func (nm *NotificationManager) PropagateUTXOsChangedNotifications(nl *NotificationListener, addresses []*UTXOsChangedNotificationAddress)

PropagateUTXOsChangedNotifications instructs the listener to send UTXOs changed notifications to the remote listener for the given addresses. Subsequent calls instruct the listener to send UTXOs changed notifications for those addresses along with the old ones. Duplicate addresses are ignored.

func (*NotificationManager) RemoveListener

func (nm *NotificationManager) RemoveListener(router *routerpkg.Router)

RemoveListener unregisters the given router

func (*NotificationManager) StopPropagatingUTXOsChangedNotifications added in v0.12.5

func (nm *NotificationManager) StopPropagatingUTXOsChangedNotifications(nl *NotificationListener, addresses []*UTXOsChangedNotificationAddress)

StopPropagatingUTXOsChangedNotifications instructs the listener to stop sending UTXOs changed notifications to the remote listener for the given addresses. Addresses for which notifications are not currently sent are ignored.

type UTXOsChangedNotificationAddress

type UTXOsChangedNotificationAddress struct {
	Address               string
	ScriptPublicKeyString utxoindex.ScriptPublicKeyString
}

UTXOsChangedNotificationAddress represents a kaspad address. This type is meant to be used in UTXOsChanged notifications

Jump to

Keyboard shortcuts

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