Skip to content

Commit

Permalink
Fix signet supprot (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradStaniec authored Jan 4, 2024
1 parent d81f7d1 commit eb72d30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 2 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ func GetBtcNetworkParams(network string) (*chaincfg.Params, error) {
return &chaincfg.RegressionNetParams, nil
case "simnet":
return &chaincfg.SimNetParams, nil
case "signet":
return &chaincfg.SigNetParams, nil
default:
return nil, fmt.Errorf("unknown network %s", network)
}
Expand Down
20 changes: 7 additions & 13 deletions walletcontroller/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (

"github.com/babylonchain/btc-staker/stakercfg"
"github.com/babylonchain/btc-staker/types"
"github.com/babylonchain/btc-staker/utils"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/rpcclient"
"github.com/btcsuite/btcd/txscript"
Expand Down Expand Up @@ -38,6 +38,7 @@ func NewRpcWalletController(scfg *stakercfg.Config) (*RpcWalletController, error
scfg.ActiveNetParams.Name,
scfg.WalletConfig.WalletPass,
scfg.BtcNodeBackendConfig.ActiveWalletBackend,
&scfg.ActiveNetParams,
// TODO for now just disable tls
true,
)
Expand All @@ -50,22 +51,15 @@ func NewRpcWalletControllerFromArgs(
network string,
walletPassphrase string,
nodeBackend types.SupportedWalletBackend,
params *chaincfg.Params,
disableTls bool,
) (*RpcWalletController, error) {

params, err := utils.GetBtcNetworkParams(network)

if err != nil {
return nil, err
}

connCfg := &rpcclient.ConnConfig{
Host: host,
User: user,
Pass: pass,
Params: network,
DisableTLS: disableTls,

Host: host,
User: user,
Pass: pass,
DisableTLS: disableTls,
DisableConnectOnNew: true,
DisableAutoReconnect: false,
// we use post mode as it sure it works with either bitcoind or btcwallet
Expand Down

0 comments on commit eb72d30

Please sign in to comment.