mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-13 11:35:40 +01:00
Fix hardcoded network for the default wallet account (#1277)
* Fix hardcoded network for the default wallet account * Refactor call to HDUtil.getCoinType()
This commit is contained in:
parent
14b13eb612
commit
5eef801813
3 changed files with 12 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
|||
package org.bitcoins.core.hd
|
||||
|
||||
import org.bitcoins.core.config.{MainNet, NetworkParameters, RegTest, TestNet3}
|
||||
|
||||
/**
|
||||
* Represents a
|
||||
* [[https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#Coin_type BIP44]],
|
||||
|
@ -33,4 +35,11 @@ object HDCoinType {
|
|||
case _: Int =>
|
||||
throw new IllegalArgumentException(s"$int is not valid coin type!")
|
||||
}
|
||||
|
||||
def fromNetwork(np: NetworkParameters): HDCoinType = {
|
||||
np match {
|
||||
case MainNet => Bitcoin
|
||||
case TestNet3 | RegTest => Testnet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,8 +74,7 @@ object HDUtil {
|
|||
}
|
||||
}
|
||||
|
||||
def getCoinType(network: NetworkParameters): HDCoinType = network match {
|
||||
case MainNet => HDCoinType.Bitcoin
|
||||
case TestNet3 | RegTest => HDCoinType.Testnet
|
||||
def getCoinType(network: NetworkParameters): HDCoinType = {
|
||||
HDCoinType.fromNetwork(network)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ case class WalletAppConfig(
|
|||
|
||||
lazy val defaultAccount: HDAccount = {
|
||||
val purpose = defaultAccountKind
|
||||
HDAccount(coin = HDCoin(purpose, HDCoinType.Testnet), index = 0)
|
||||
HDAccount(coin = HDCoin(purpose, HDCoinType.fromNetwork(network)), index = 0)
|
||||
}
|
||||
|
||||
lazy val bloomFalsePositiveRate: Double =
|
||||
|
|
Loading…
Add table
Reference in a new issue