Skip to content

Commit

Permalink
Also test unwraping of onion message
Browse files Browse the repository at this point in the history
  • Loading branch information
thomash-acinq committed Apr 12, 2023
1 parent 4f0b280 commit c619eaf
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,5 +320,26 @@ class OnionMessagesSpec extends AnyFunSuite {
val encodedPacket = OnionRoutingCodecs.onionRoutingPacketCodec(1300).encode(message.onionRoutingPacket).require.bytes.toHex
val expectedPacket = (testVector \ "onionmessage" \ "onion_message_packet").extract[String]
assert(encodedPacket == expectedPacket)

// Checking that the onion is relayed properly
process(alice, message) match {
case SendMessage(nextNodeId, onionForBob) =>
assert(nextNodeId == bob.publicKey)
process(bob, onionForBob) match {
case SendMessage(nextNodeId, onionForCarol) =>
assert(nextNodeId == carol.publicKey)
process(carol, onionForCarol) match {
case SendMessage(nextNodeId, onionForDave) =>
assert(nextNodeId == dave.publicKey)
process(dave, onionForDave) match {
case ReceiveMessage(finalPayload) => assert(finalPayload.pathId_opt.contains(pathId))
case x => fail(x.toString)
}
case x => fail(x.toString)
}
case x => fail(x.toString)
}
case x => fail(x.toString)
}
}
}

0 comments on commit c619eaf

Please sign in to comment.