Documentation ¶
Index ¶
- Variables
- type MockPoolAddressValidator
- func (mpa *MockPoolAddressValidator) AddNodePubKey(pk common.PubKey)
- func (mpa *MockPoolAddressValidator) AddPubKey(pk common.PubKey, _ bool)
- func (mpa *MockPoolAddressValidator) GetContract(chain common.Chain, pk common.PubKey) common.Address
- func (mpa *MockPoolAddressValidator) GetContracts(chain common.Chain) []common.Address
- func (mpa *MockPoolAddressValidator) GetNodePubKey() common.PubKey
- func (mpa *MockPoolAddressValidator) GetPubKeys() common.PubKeys
- func (mpa *MockPoolAddressValidator) GetSignPubKeys() common.PubKeys
- func (mpa *MockPoolAddressValidator) HasPubKey(pk common.PubKey) bool
- func (mpa *MockPoolAddressValidator) IsValidPoolAddress(addr string, chain common.Chain) (bool, common.ChainPoolInfo)
- func (mpa *MockPoolAddressValidator) RegisterCallback(callback OnNewPubKey)
- func (mpa *MockPoolAddressValidator) RemovePubKey(pk common.PubKey)
- func (mpa *MockPoolAddressValidator) Start() error
- func (mpa *MockPoolAddressValidator) Stop() error
- type OnNewPubKey
- type PubKeyManager
- func (pkm *PubKeyManager) AddNodePubKey(pk common.PubKey)
- func (pkm *PubKeyManager) AddPubKey(pk common.PubKey, signer bool)
- func (pkm *PubKeyManager) GetContract(chain common.Chain, pubKey common.PubKey) common.Address
- func (pkm *PubKeyManager) GetContracts(chain common.Chain) []common.Address
- func (pkm *PubKeyManager) GetNodePubKey() common.PubKey
- func (pkm *PubKeyManager) GetPubKeys() common.PubKeys
- func (pkm *PubKeyManager) GetSignPubKeys() common.PubKeys
- func (pkm *PubKeyManager) HasPubKey(pk common.PubKey) bool
- func (pkm *PubKeyManager) IsValidPoolAddress(addr string, chain common.Chain) (bool, common.ChainPoolInfo)
- func (pkm *PubKeyManager) RegisterCallback(callback OnNewPubKey)
- func (pkm *PubKeyManager) RemovePubKey(pk common.PubKey)
- func (pkm *PubKeyManager) Start() error
- func (pkm *PubKeyManager) Stop() error
- type PubKeyValidator
Constants ¶
This section is empty.
Variables ¶
var (
MockPubkey = "tmayapub1addwnpepqt8tnluxnk3y5quyq952klgqnlmz2vmaynm40fp592s0um7ucvjh5eguqr3"
)
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 ¶
func (*MockPoolAddressValidator) GetContracts ¶
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 ¶
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 ¶
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 mayaclient.MayachainBridge, 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 ¶
GetContract return the contract address that match the given chain and pubkey
func (*PubKeyManager) GetContracts ¶
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 ¶
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
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