Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouop0 authored and 0x677261706562616261 committed Nov 21, 2023
1 parent 7b30af0 commit c4db3b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 5 additions & 2 deletions x/bitcoincommiter/keeper/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ const (
BitcoinRPCConfigFileName = "bitcoin.yaml"
)

func DefaultBITCOINConfig(homePath string) (*BITCOINConfig, error) {
func DefaultBITCOINConfig(homePath string) *BITCOINConfig {
data, err := os.ReadFile(homePath + "/" + BitcoinRPCConfigFileName)
if err != nil {
log.Fatalf("can not read rpc config file: %v", err)
}
config := BITCOINConfig{}
err = yaml.Unmarshal(data, &config)
return &config, err
if err != nil {
log.Fatalf("can not unmarshal rpc config file: %v", err)
}
return &config
}
2 changes: 1 addition & 1 deletion x/bitcoincommiter/keeper/connfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestConfig(t *testing.T) {
config, _ := keeper.DefaultBITCOINConfig("../test/source")
config := keeper.DefaultBITCOINConfig("../test/source")
require.Equal(t, "signet", config.NetworkName)
require.Equal(t, "localhost", config.RPCHost)
require.Equal(t, "8332", config.RPCPort)
Expand Down
3 changes: 1 addition & 2 deletions x/bitcoincommiter/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ func NewKeeper(
ps paramtypes.Subspace,
homePath string,
) *Keeper {
bitcoinConfig, _ := DefaultBITCOINConfig(homePath)
return &Keeper{
cdc: cdc,
memKey: memKey,
paramstore: ps,
config: bitcoinConfig,
config: DefaultBITCOINConfig(homePath),
}
}

Expand Down

0 comments on commit c4db3b1

Please sign in to comment.