Hotfix: Prevent ZMQ-based bitcoin wallet to panic (#383)

* Hotfix bct embedded wallet w/ ZMQ

* Fixes
This commit is contained in:
Pietralberto Mazza
2024-11-19 14:13:17 +01:00
committed by GitHub
parent 0d2db92173
commit 247c8bcadf

View File

@@ -226,7 +226,7 @@ func WithPollingBitcoind(host, user, pass string) WalletOption {
User: bitcoindConfig.User,
Pass: bitcoindConfig.Pass,
},
"CONSERVATIVE",
"ECONOMICAL",
chainfee.AbsoluteFeePerKwFloor,
)
if err != nil {
@@ -298,6 +298,27 @@ func WithBitcoindZMQ(block, tx string, host, user, pass string) WalletOption {
time.Sleep(1 * time.Second)
}
estimator, err := chainfee.NewBitcoindEstimator(
rpcclient.ConnConfig{
Host: bitcoindConfig.Host,
User: bitcoindConfig.User,
Pass: bitcoindConfig.Pass,
},
"ECONOMICAL",
chainfee.AbsoluteFeePerKwFloor,
)
if err != nil {
return fmt.Errorf("failed to create bitcoind fee estimator: %w", err)
}
if err := withExtraAPI(&bitcoindRPCClient{chainClient})(s); err != nil {
return err
}
if err := withFeeEstimator(estimator)(s); err != nil {
return err
}
if err := withChainSource(chainClient)(s); err != nil {
chainClient.Stop()
bitcoindConn.Stop()