Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouop0 committed Nov 17, 2023
1 parent f010942 commit 96a2138
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions bitcoin/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ func TestSetBitcoinConfig(t *testing.T) {
// Create a new BitcoinConfig instance.
config := config.BITCOINConfig{
NetworkName: "mainnet",
RpcHost: "username",
RpcUser: "password",
RpcPass: "localhost",
RPCHost: "username",
RPCUser: "password",
RPCPass: "localhost",
WalletName: "ss",
}

// Call the SetBitcoinConfig function.
rpcConfig := SetBitcoinConfig(config)
require.Equal(t, rpcConfig.Params, chaincfg.MainNetParams)
require.Equal(t, rpcConfig.ConnConfig.Host, config.RpcHost)
require.Equal(t, rpcConfig.ConnConfig.User, config.RpcUser)
require.Equal(t, rpcConfig.ConnConfig.Pass, config.RpcPass)
require.Equal(t, rpcConfig.ConnConfig.Host, config.RPCHost)
require.Equal(t, rpcConfig.ConnConfig.User, config.RPCUser)
require.Equal(t, rpcConfig.ConnConfig.Pass, config.RPCPass)
}
6 changes: 3 additions & 3 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,13 +434,13 @@ func (c BITCOINConfig) Validate() error {
if c.NetworkName != "" && !strings.StringInSlice(c.NetworkName, bitcoinNetworkNames) {
return fmt.Errorf("invalid network name %s, available names: %v", c.NetworkName, bitcoinNetworkNames)
}
if c.RPCHost != "" {
if c.RPCHost == "" {
return fmt.Errorf("rpc host is not allowed empty")
}
if c.RPCPass != "" {
if c.RPCPass == "" {
return fmt.Errorf("rpc pass is not allowed empty")
}
if c.WalletName != "" {
if c.WalletName == "" {
return fmt.Errorf("rpc wallet name is not allowed empty")
}
return nil
Expand Down

0 comments on commit 96a2138

Please sign in to comment.