rpccontext

package
v0.8.4-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: ISC Imports: 28 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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) BuildBlockVerboseData

func (ctx *Context) BuildBlockVerboseData(blockHeader externalapi.BlockHeader, includeTransactionVerboseData bool) (*appmessage.BlockVerboseData, error)

BuildBlockVerboseData builds a BlockVerboseData from the given block.

func (*Context) BuildTransactionVerboseData

func (ctx *Context) BuildTransactionVerboseData(tx *externalapi.DomainTransaction, txID string,
	blockHeader externalapi.BlockHeader, blockHash string) (
	*appmessage.TransactionVerboseData, error)

BuildTransactionVerboseData builds a TransactionVerboseData from the given parameters

func (*Context) ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage

func (ctx *Context) ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage(
	selectedParentChainChanges *externalapi.SelectedParentChainChanges) (*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.

type NotificationListener

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

NotificationListener represents a registered RPC notification listener

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) PropagateUTXOsChangedNotifications

func (nl *NotificationListener) PropagateUTXOsChangedNotifications(addresses []*UTXOsChangedNotificationAddress)

PropagateUTXOsChangedNotifications instructs the listener to send UTXOs changed 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()

PropagateVirtualSelectedParentChainChangedNotifications instructs the listener to send chain changed 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() *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) 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) NotifyUTXOsChanged

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

NotifyUTXOsChanged notifies the notification manager that UTXOs have been 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) RemoveListener

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

RemoveListener unregisters the given router

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