mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-09 01:26:19 +00:00
Rework PR to memoize public key on init:
- split PubKeyMsg into PubKeyRequest / PubKeyResponse like other msgs - NewRemoteSignerClient sends a pubkey request (once), return this err OnStart() - NewRemoteSignerClient returns an error if retrieving the pubkey fails - remove GetAddress from PrivValidator interface - GetPublicKey doesn't err but returns memoized public key from init - fix tests
This commit is contained in:
+3
-12
@@ -240,19 +240,13 @@ func NewNode(config *cfg.Config,
|
||||
fastSync := config.FastSync
|
||||
if state.Validators.Size() == 1 {
|
||||
addr, _ := state.Validators.GetByIndex(0)
|
||||
privValAddr, err := privValidator.GetAddress()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
privValAddr := privValidator.GetPubKey().Address()
|
||||
if bytes.Equal(privValAddr, addr) {
|
||||
fastSync = false
|
||||
}
|
||||
}
|
||||
|
||||
pubKey, err := privValidator.GetPubKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pubKey := privValidator.GetPubKey()
|
||||
addr := pubKey.Address()
|
||||
// Log whether this node is a validator or an observer
|
||||
if state.Validators.HasAddress(addr) {
|
||||
@@ -625,10 +619,7 @@ func (n *Node) ConfigureRPC() {
|
||||
rpccore.SetEvidencePool(n.evidencePool)
|
||||
rpccore.SetP2PPeers(n.sw)
|
||||
rpccore.SetP2PTransport(n)
|
||||
pubKey, err := n.privValidator.GetPubKey()
|
||||
if err != nil {
|
||||
n.Logger.Error("Error configuring RPC", "err", err)
|
||||
}
|
||||
pubKey := n.privValidator.GetPubKey()
|
||||
rpccore.SetPubKey(pubKey)
|
||||
rpccore.SetGenesisDoc(n.genesisDoc)
|
||||
rpccore.SetAddrBook(n.addrBook)
|
||||
|
||||
Reference in New Issue
Block a user