mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-23 06:45:21 +01:00
Add address descriptors (#2176)
This commit is contained in:
parent
890f4af04c
commit
913f705167
2 changed files with 8 additions and 0 deletions
|
@ -30,4 +30,10 @@ class AddressTest extends BitcoinSUnitTest {
|
|||
TestUtil.bech32Address.toString must be(
|
||||
"bcrt1qq6w6pu6zq90az9krn53zlkvgyzkyeglzukyepf")
|
||||
}
|
||||
|
||||
it must "calculate the correct descriptor" in {
|
||||
forAll(AddressGenerator.address) { addr =>
|
||||
assert(addr.descriptor == s"addr(${addr.value})")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ sealed abstract class Address {
|
|||
def scriptPubKey: ScriptPubKey
|
||||
|
||||
override def toString: String = value
|
||||
|
||||
def descriptor: String = s"addr($value)"
|
||||
}
|
||||
|
||||
sealed abstract class BitcoinAddress extends Address
|
||||
|
|
Loading…
Add table
Reference in a new issue