Skip to content

Commit

Permalink
fix unittests (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoyangLiu authored Jan 18, 2021
1 parent 0605240 commit fdc0cfa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions executor/bbc_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ func initBBCClients(keyManager keys.KeyManager, providers []string, network ctyp
}

func NewBBCExecutor(cfg *config.Config, networkType ctypes.ChainNetwork) (*BBCExecutor, error) {
mnemonic, err := getMnemonic(&cfg.BBCConfig)
if err != nil {
panic(err.Error())
}

keyManager, err := keys.NewMnemonicKeyManager(mnemonic)
if err != nil {
panic(err.Error())
var keyManager keys.KeyManager
if len(cfg.BSCConfig.MonitorDataSeedList) >= 2 {
mnemonic, err := getMnemonic(&cfg.BBCConfig)
if err != nil {
panic(err.Error())
}
keyManager, err = keys.NewMnemonicKeyManager(mnemonic)
if err != nil {
panic(err.Error())
}
}

return &BBCExecutor{
Expand Down
6 changes: 3 additions & 3 deletions executor/bsc_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ var (
DestChainID: 97,
},
BBCConfig: config.BBCConfig{
RpcAddrs: BBCRpc,
RpcAddrs: []string{BBCRpc},
},
BSCConfig: config.BSCConfig{
GasLimit: 4700000,
Providers: provider,
Providers: []string{provider},
PrivateKey: privateKey,
KeyType: config.KeyTypeLocalPrivateKey,
},
Expand Down Expand Up @@ -202,7 +202,7 @@ func TestBSCExecutor_CheckRelayer(t *testing.T) {
callOpts, err := executor.getCallOpts()
require.NoError(t, err)

instance, err := relayerhub.NewRelayerhub(relayerHubContractAddr, executor.bscClients)
instance, err := relayerhub.NewRelayerhub(relayerHubContractAddr, executor.GetClient())
require.NoError(t, err)

isRelayer, err := instance.IsRelayer(callOpts, executor.txSender)
Expand Down

0 comments on commit fdc0cfa

Please sign in to comment.