mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-03 18:47:38 +01:00
Support bip32 paths with 'h' instead of an apostrophe (#4881)
This commit is contained in:
parent
7a64accd69
commit
cc8d327ea5
2 changed files with 7 additions and 1 deletions
|
@ -90,6 +90,12 @@ class BIP32PathTest extends BitcoinSUnitTest {
|
|||
assert(fromString.path.head.toUInt32 == ExtKey.hardenedIdx)
|
||||
}
|
||||
|
||||
it must "parse a hardened path without an apostrophe" in {
|
||||
val fromString = BIP32Path.fromString("m/0h")
|
||||
assert(fromString.path.length == 1)
|
||||
assert(fromString.path.head.toUInt32 == ExtKey.hardenedIdx)
|
||||
}
|
||||
|
||||
it must "parse a hardened path from bytes" in {
|
||||
val fromString = BIP32Path.fromBytes(hex"0x80000000")
|
||||
assert(fromString.path.length == 1)
|
||||
|
|
|
@ -136,7 +136,7 @@ object BIP32Path extends Factory[BIP32Path] with StringFactory[BIP32Path] {
|
|||
|
||||
val path = rest.map { str =>
|
||||
val (index: String, hardened: Boolean) =
|
||||
if (str.endsWith("'")) {
|
||||
if (str.endsWith("'") || str.endsWith("h")) {
|
||||
(str.dropRight(1), true)
|
||||
} else {
|
||||
(str, false)
|
||||
|
|
Loading…
Add table
Reference in a new issue