Allow both lnmessage and raw tlv to be sent over rpc for acceptdlc (#4140)

This commit is contained in:
Chris Stewart 2022-03-01 06:13:59 -06:00 committed by GitHub
parent 44b2ca3c3d
commit b86d4e492c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -934,8 +934,14 @@ object AcceptDLC extends ServerJsonModels {
offerJs: Value,
addrJs: Value,
payoutAddressJs: Value,
changeAddressJs: Value) = Try {
val offer = LnMessageFactory(DLCOfferTLV).fromHex(offerJs.str)
changeAddressJs: Value): Try[AcceptDLC] = Try {
val lnMessageOfferT = LnMessageFactory(DLCOfferTLV)
.fromHexT(offerJs.str)
val offer: LnMessage[DLCOfferTLV] = lnMessageOfferT match {
case Success(o) => o
case Failure(_) => LnMessage(DLCOfferTLV.fromHex(offerJs.str))
}
val uri = new URI("tcp://" + addrJs.str)
val peerAddr =
InetSocketAddress.createUnresolved(uri.getHost, uri.getPort)