From 2cf4d50c23d6274807bce2f69281aa15aa83d30d Mon Sep 17 00:00:00 2001 From: Leo Date: Wed, 10 Feb 2021 02:00:45 +0100 Subject: [PATCH] bridge: add terra block height to heartbeats --- bridge/pkg/terra/watcher.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bridge/pkg/terra/watcher.go b/bridge/pkg/terra/watcher.go index 61b66b152..09e620573 100644 --- a/bridge/pkg/terra/watcher.go +++ b/bridge/pkg/terra/watcher.go @@ -4,6 +4,8 @@ import ( "context" "encoding/hex" "fmt" + "github.com/certusone/wormhole/bridge/pkg/p2p" + gossipv1 "github.com/certusone/wormhole/bridge/pkg/proto/gossip/v1" "io/ioutil" "math/big" "net/http" @@ -82,6 +84,10 @@ func NewTerraBridgeWatcher(urlWS string, urlLCD string, bridge string, lockEvent // Run is the main Terra Bridge run cycle func (e *BridgeWatcher) Run(ctx context.Context) error { + p2p.DefaultRegistry.SetNetworkStats(vaa.ChainIDTerra, &gossipv1.Heartbeat_Network{ + BridgeAddress: e.bridge, + }) + errC := make(chan error) logger := supervisor.Logger(ctx) @@ -146,6 +152,10 @@ func (e *BridgeWatcher) Run(ctx context.Context) error { latestBlock := gjson.Get(blockJSON, "block.header.height") logger.Info("current Terra height", zap.Int64("block", latestBlock.Int())) currentTerraHeight.Set(float64(latestBlock.Int())) + p2p.DefaultRegistry.SetNetworkStats(vaa.ChainIDTerra, &gossipv1.Heartbeat_Network{ + Height: latestBlock.Int(), + BridgeAddress: e.bridge, + }) } }()