Skip to content

Commit

Permalink
Hotfix: Prevent ZMQ-based bitcoin wallet to panic (ark-network#383)
Browse files Browse the repository at this point in the history
* Hotfix bct embedded wallet w/ ZMQ

* Fixes
  • Loading branch information
altafan authored Nov 19, 2024
1 parent 0d2db92 commit 247c8bc
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion server/internal/infrastructure/wallet/btc-embedded/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func WithPollingBitcoind(host, user, pass string) WalletOption {
User: bitcoindConfig.User,
Pass: bitcoindConfig.Pass,
},
"CONSERVATIVE",
"ECONOMICAL",
chainfee.AbsoluteFeePerKwFloor,
)
if err != nil {
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 247c8bc

Please sign in to comment.