-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Requesting BIP353 address from peer (#683)
The peer will only answer if there is a channel. Optionally pass an IETF BCP 47 language tag (en, fr, de, es, ...) to indicate preference for the words that make up the address.
- Loading branch information
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import fr.acinq.lightning.tests.utils.LightningTestSuite | |
import fr.acinq.lightning.utils.msat | ||
import fr.acinq.lightning.utils.sat | ||
import fr.acinq.lightning.utils.toByteVector | ||
import fr.acinq.lightning.wire.OfferTypes.Offer | ||
import fr.acinq.secp256k1.Hex | ||
import kotlinx.serialization.json.Json | ||
import kotlinx.serialization.json.jsonArray | ||
|
@@ -874,4 +875,19 @@ class LightningCodecsTestsCommon : LightningTestSuite() { | |
val onionMessage = OnionMessages.buildMessage(randomKey(), randomKey(), listOf(), OnionMessages.Destination.Recipient(EncodedNodeId(randomKey().publicKey()), null), TlvStream.empty()).right!! | ||
assertEquals(onionMessage, OnionMessage.read(onionMessage.write())) | ||
} | ||
|
||
@Test | ||
fun `encode and decode dns address request`() { | ||
val encoded = "lno1qgsyxjtl6luzd9t3pr62xr7eemp6awnejusgf6gw45q75vcfqqqqqqqgqyeq5ym0venx2u3qwa5hg6pqw96kzmn5d968jys3v9kxjcm9gp3xjemndphhqtnrdak3gqqkyypsmuhrtwfzm85mht4a3vcp0yrlgua3u3m5uqpc6kf7nqjz6v70qwg" | ||
val offer = Offer.decode(encoded).get() | ||
|
||
val msg = DNSAddressRequest(Chain.Testnet.chainHash, offer, "en") | ||
assertEquals(msg, LightningMessage.decode(LightningMessage.encode(msg))) | ||
} | ||
|
||
@Test | ||
fun `encode and decode dns address response`() { | ||
val msg = DNSAddressResponse(Chain.Testnet.chainHash, "[email protected]") | ||
assertEquals(msg, LightningMessage.decode(LightningMessage.encode(msg))) | ||
} | ||
} |