pubkeymanager

package
v1.84.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 13 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockPoolAddressValidator

type MockPoolAddressValidator struct{}

func NewMockPoolAddressValidator

func NewMockPoolAddressValidator() *MockPoolAddressValidator

func (*MockPoolAddressValidator) AddNodePubKey

func (mpa *MockPoolAddressValidator) AddNodePubKey(pk common.PubKey)

func (*MockPoolAddressValidator) AddPubKey

func (mpa *MockPoolAddressValidator) AddPubKey(pk common.PubKey, _ bool)

func (*MockPoolAddressValidator) GetContract added in v0.41.0

func (mpa *MockPoolAddressValidator) GetContract(chain common.Chain, pk common.PubKey) common.Address

func (*MockPoolAddressValidator) GetContracts added in v0.41.0

func (mpa *MockPoolAddressValidator) GetContracts(chain common.Chain) []common.Address

func (*MockPoolAddressValidator) GetNodePubKey

func (mpa *MockPoolAddressValidator) GetNodePubKey() common.PubKey

func (*MockPoolAddressValidator) GetPubKeys

func (mpa *MockPoolAddressValidator) GetPubKeys() common.PubKeys

func (*MockPoolAddressValidator) GetSignPubKeys

func (mpa *MockPoolAddressValidator) GetSignPubKeys() common.PubKeys

func (*MockPoolAddressValidator) HasPubKey

func (mpa *MockPoolAddressValidator) HasPubKey(pk common.PubKey) bool

func (*MockPoolAddressValidator) IsValidPoolAddress

func (mpa *MockPoolAddressValidator) IsValidPoolAddress(addr string, chain common.Chain) (bool, common.ChainPoolInfo)

func (*MockPoolAddressValidator) RegisterCallback added in v0.41.0

func (mpa *MockPoolAddressValidator) RegisterCallback(callback OnNewPubKey)

func (*MockPoolAddressValidator) RemovePubKey

func (mpa *MockPoolAddressValidator) RemovePubKey(pk common.PubKey)

func (*MockPoolAddressValidator) Start

func (mpa *MockPoolAddressValidator) Start() error

func (*MockPoolAddressValidator) Stop

func (mpa *MockPoolAddressValidator) Stop() error

type OnNewPubKey added in v0.41.0

type OnNewPubKey func(pk common.PubKey) error

OnNewPubKey is a function that used as a callback , if somehow we need to do additional process when a new pubkey get added

type PubKeyManager

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

PubKeyManager manager an always up to date pubkeys , which implement PubKeyValidator interface

func NewPubKeyManager

func NewPubKeyManager(bridge *thorclient.ThorchainBridge, m *metrics.Metrics) (*PubKeyManager, error)

NewPubKeyManager create a new instance of PubKeyManager

func (*PubKeyManager) AddNodePubKey

func (pkm *PubKeyManager) AddNodePubKey(pk common.PubKey)

AddNodePubKey add the given public key as a node public key to internal storage

func (*PubKeyManager) AddPubKey

func (pkm *PubKeyManager) AddPubKey(pk common.PubKey, signer bool)

AddPubKey add the given public key to internal storage

func (*PubKeyManager) GetContract added in v0.41.0

func (pkm *PubKeyManager) GetContract(chain common.Chain, pubKey common.PubKey) common.Address

GetContract return the contract address that match the given chain and pubkey

func (*PubKeyManager) GetContracts added in v0.41.0

func (pkm *PubKeyManager) GetContracts(chain common.Chain) []common.Address

GetContracts return all the contracts for the requested chain

func (*PubKeyManager) GetNodePubKey

func (pkm *PubKeyManager) GetNodePubKey() common.PubKey

GetNodePubKey get node account pub key

func (*PubKeyManager) GetPubKeys

func (pkm *PubKeyManager) GetPubKeys() common.PubKeys

GetPubKeys return all the public keys managed by this PubKeyManager

func (*PubKeyManager) GetSignPubKeys

func (pkm *PubKeyManager) GetSignPubKeys() common.PubKeys

GetSignPubKeys get all the public keys that local node is a signer

func (*PubKeyManager) HasPubKey

func (pkm *PubKeyManager) HasPubKey(pk common.PubKey) bool

HasPubKey return true if the given public key exist

func (*PubKeyManager) IsValidPoolAddress

func (pkm *PubKeyManager) IsValidPoolAddress(addr string, chain common.Chain) (bool, common.ChainPoolInfo)

IsValidPoolAddress check whether the given address is a pool addr

func (*PubKeyManager) RegisterCallback added in v0.41.0

func (pkm *PubKeyManager) RegisterCallback(callback OnNewPubKey)

RegisterCallback register a call back that will be fired when a new key get added into the local memory storage

func (*PubKeyManager) RemovePubKey

func (pkm *PubKeyManager) RemovePubKey(pk common.PubKey)

RemovePubKey remove the given public key from internal storage

func (*PubKeyManager) Start

func (pkm *PubKeyManager) Start() error

Start to poll pubkeys from thorchain

func (*PubKeyManager) Stop

func (pkm *PubKeyManager) Stop() error

Stop pubkey manager

type PubKeyValidator

type PubKeyValidator interface {
	IsValidPoolAddress(addr string, chain common.Chain) (bool, common.ChainPoolInfo)
	HasPubKey(pk common.PubKey) bool
	AddPubKey(pk common.PubKey, _ bool)
	AddNodePubKey(pk common.PubKey)
	RemovePubKey(pk common.PubKey)
	GetSignPubKeys() common.PubKeys
	GetNodePubKey() common.PubKey
	GetPubKeys() common.PubKeys
	RegisterCallback(callback OnNewPubKey)
	GetContracts(chain common.Chain) []common.Address
	GetContract(chain common.Chain, pk common.PubKey) common.Address
}

PubKeyValidator define the method that can be used to interact with public keys

Jump to

Keyboard shortcuts

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