forked from evmos/ethermint
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package bitcoin | ||
|
||
import ( | ||
"github.com/btcsuite/btcd/chaincfg" | ||
"github.com/btcsuite/btcd/rpcclient" | ||
"github.com/evmos/ethermint/server/config" | ||
) | ||
|
||
// Config this param use for holding bitcoin rpc config | ||
var Config RpcConfig | ||
|
||
// RpcConfig this struct use for storing bitcoin rpc config | ||
type RpcConfig struct { | ||
ConnConfig rpcclient.ConnConfig | ||
Params chaincfg.Params | ||
} | ||
|
||
// SetBitcoinConfig this method uses for setting bitcoin rpc | ||
func SetBitcoinConfig(config config.BITCOINConfig) RpcConfig { | ||
var params chaincfg.Params | ||
switch config.NetworkName { | ||
case chaincfg.SigNetParams.Name: | ||
params = chaincfg.SigNetParams | ||
case chaincfg.MainNetParams.Name: | ||
params = chaincfg.MainNetParams | ||
case chaincfg.TestNet3Params.Name: | ||
params = chaincfg.TestNet3Params | ||
case chaincfg.SimNetParams.Name: | ||
params = chaincfg.SimNetParams | ||
case chaincfg.RegressionNetParams.Name: | ||
params = chaincfg.RegressionNetParams | ||
default: | ||
params = chaincfg.MainNetParams | ||
} | ||
Config = RpcConfig{ | ||
ConnConfig: rpcclient.ConnConfig{ | ||
Host: config.RpcHost, | ||
}, | ||
Params: params, | ||
} | ||
return Config | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters