-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(btcclient): use notifier interface #20
Merged
Merged
Changes from 10 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3f0bb19
reporter uses notifier
Lazar955 1991b21
monitor uses notifier
Lazar955 55c846d
use btc client without subscription
Lazar955 eaa9900
remove zmq impl
Lazar955 8575dd1
update mocks
Lazar955 998cee9
cleanup unused code
Lazar955 376bc3a
cleanup
Lazar955 93f04e3
fix test
Lazar955 3d19173
build flag
Lazar955 e3eb8b7
rm commented out code
Lazar955 bdf4f9e
pr comments
Lazar955 f7335e2
btc scanner merge handle block logic
Lazar955 df198b3
rm unused code
Lazar955 e47d580
combine booststrap and blockevent handle
Lazar955 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ package cmd | |
|
||
import ( | ||
"fmt" | ||
"github.com/babylonlabs-io/vigilante/netparams" | ||
|
||
bbnclient "github.com/babylonlabs-io/babylon/client/client" | ||
"github.com/spf13/cobra" | ||
|
@@ -48,7 +49,7 @@ func GetReporterCmd() *cobra.Command { | |
|
||
// create BTC client and connect to BTC server | ||
// Note that vigilant reporter needs to subscribe to new BTC blocks | ||
btcClient, err = btcclient.NewWithBlockSubscriber(&cfg.BTC, cfg.Common.RetrySleepTime, cfg.Common.MaxRetrySleepTime, rootLogger) | ||
btcClient, err = btcclient.NewWallet(&cfg.BTC, rootLogger) | ||
if err != nil { | ||
panic(fmt.Errorf("failed to open BTC client: %w", err)) | ||
} | ||
|
@@ -62,12 +63,24 @@ func GetReporterCmd() *cobra.Command { | |
// register reporter metrics | ||
reporterMetrics := metrics.NewReporterMetrics() | ||
|
||
// create the chain notifier | ||
btcParams, err := netparams.GetBTCParams(cfg.BTC.NetParams) | ||
if err != nil { | ||
panic(fmt.Errorf("failed to get BTC net params: %w", err)) | ||
} | ||
btcCfg := btcclient.CfgToBtcNodeBackendConfig(cfg.BTC, "") | ||
btcNotifier, err := btcclient.NewNodeBackend(btcCfg, btcParams, &btcclient.EmptyHintCache{}) | ||
if err != nil { | ||
panic(fmt.Errorf("failed to initialize notifier: %w", err)) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This chunk is duplicated across several programs. Maybe we can wrap it into a general constructor? |
||
|
||
// create reporter | ||
vigilantReporter, err = reporter.New( | ||
&cfg.Reporter, | ||
rootLogger, | ||
btcClient, | ||
babylonClient, | ||
btcNotifier, | ||
cfg.Common.RetrySleepTime, | ||
cfg.Common.MaxRetrySleepTime, | ||
reporterMetrics, | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rawCert
is needed for btcd, which we wanted to remove, correct?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, there's a new issue to remove btcd from repo (previously merged PR regarding that was to use it in e2e)