-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Solana RPC status check and refactor EVM and bitcoin RPC status c…
…heck
- Loading branch information
1 parent
53883f5
commit 989ccca
Showing
15 changed files
with
323 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package observer | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin/rpc" | ||
"github.com/zeta-chain/zetacore/zetaclient/common" | ||
) | ||
|
||
// WatchRPCStatus watches the RPC status of the Bitcoin chain | ||
func (ob *Observer) WatchRPCStatus(_ context.Context) error { | ||
ob.Logger().Chain.Info().Msgf("WatchRPCStatus started for chain %d", ob.Chain().ChainId) | ||
|
||
ticker := time.NewTicker(common.RPCStatusCheckInterval) | ||
for { | ||
select { | ||
case <-ticker.C: | ||
if !ob.GetChainParams().IsSupported { | ||
continue | ||
} | ||
|
||
tssAddress := ob.TSS().BTCAddressWitnessPubkeyHash() | ||
err := rpc.CheckRPCStatus(ob.btcClient, tssAddress, ob.Logger().Chain) | ||
if err != nil { | ||
ob.Logger().Chain.Error().Err(err).Msg("RPC Status error") | ||
} | ||
|
||
case <-ob.StopChannel(): | ||
return nil | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Package observer implements the EVM chain observer | ||
package observer | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/zeta-chain/zetacore/zetaclient/chains/evm/rpc" | ||
"github.com/zeta-chain/zetacore/zetaclient/common" | ||
) | ||
|
||
// WatchRPCStatus watches the RPC status of the evm chain | ||
func (ob *Observer) WatchRPCStatus(ctx context.Context) error { | ||
ob.Logger().Chain.Info().Msgf("WatchRPCStatus started for chain %d", ob.Chain().ChainId) | ||
|
||
ticker := time.NewTicker(common.RPCStatusCheckInterval) | ||
for { | ||
select { | ||
case <-ticker.C: | ||
if !ob.GetChainParams().IsSupported { | ||
continue | ||
} | ||
|
||
err := rpc.CheckRPCStatus(ctx, ob.evmClient, ob.Logger().Chain) | ||
if err != nil { | ||
ob.Logger().Chain.Error().Err(err).Msg("RPC Status error") | ||
} | ||
case <-ob.StopChannel(): | ||
return nil | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.