Skip to content

Commit

Permalink
Export a descriptor for swap-in recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
sstone committed Jan 17, 2024
1 parent e5dad76 commit bae7be8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ interface KeyManager {
val legacySwapInProtocol = SwapInProtocolLegacy(userPublicKey, remoteServerPublicKey, refundDelay)

val swapInProtocol = SwapInProtocol(userPublicKey, remoteServerPublicKey, userRefundPublicKey, refundDelay)
val descriptor = SwapInProtocol.descriptor(chain, userPublicKey, remoteServerPublicKey, refundDelay, userRefundExtendedPrivateKey)

/**
* The output script descriptor matching our legacy swap-in addresses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ class SwapInProtocol(val userPublicKey: PublicKey, val serverPublicKey: PublicKe
else -> DeterministicWallet.tprv
}
val xpriv = DeterministicWallet.encode(masterRefundKey, prefix)
val path = masterRefundKey.path.toString().replace('\'', 'h').removePrefix("m")
val desc = "tr(${internalPubKey.value},and_v(v:pk($xpriv$path/*),older($refundDelay)))"
val desc = "tr(${internalPubKey.value},and_v(v:pk($xpriv/*),older($refundDelay)))"
val checksum = Descriptor.checksum(desc)
return "$desc#$checksum"
}
Expand Down

0 comments on commit bae7be8

Please sign in to comment.