bridge: log own peer ID at startup

This commit is contained in:
Leo 2020-12-06 20:26:12 +01:00
parent 3013f24d59
commit b077104086
1 changed files with 9 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"os"
p2pcrypto "github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"
"go.uber.org/zap"
)
@ -41,7 +42,14 @@ func getOrCreateNodeKey(logger *zap.Logger, path string) (p2pcrypto.PrivKey, err
return nil, fmt.Errorf("failed to unmarshal node key: %w", err)
}
logger.Info("Found existing node key", zap.String("path", path))
peerID, err := peer.IDFromPrivateKey(priv)
if err != nil {
panic(err)
}
logger.Info("Found existing node key",
zap.String("path", path),
zap.Stringer("peerID", peerID))
return priv, nil
}