Fix ability for plugins to exchange custom Lightning Messages with other LN nodes [PeerSwap]#2495
Conversation
This is an assumption of TLVs, does it mean that you're using messages that are not TLVs? Why? |
7cf95a0 to
61df644
Compare
The length is still implicitly encoded, none of the other Lightning Message codecs explicitly encode the length of the payload like |
It looked like a TLV at first glance but you're right, it's not, so the tag doesn't have to be followed by a size. |
eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/FailureMessage.scala
Outdated
Show resolved
Hide resolved
61df644 to
5565bad
Compare
Codecov Report
@@ Coverage Diff @@
## master #2495 +/- ##
==========================================
+ Coverage 84.98% 85.01% +0.02%
==========================================
Files 198 200 +2
Lines 15839 15833 -6
Branches 682 675 -7
==========================================
- Hits 13461 13460 -1
+ Misses 2378 2373 -5
|
|
This issue of whether or not to include the type prefix is resolved in BOLT 4 PR #979. We should be able to remove parsing of historical failure messages with un-prefixed |
|
Is there a way to find out how many failure messages we get that are missing the type prefix for the embedded |
I would also be interested in some numbers, as I'd like to be able to remove said parsing ambiguity from LDK/rust-lightning. However, I assume it's not ready yet, as LND still doesn't seem to write the type prefix?: lightningnetwork/lnd#6461 |
eclair-core/src/main/scala/fr/acinq/eclair/transactions/Transactions.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/LightningMessageCodecs.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/Channel.scala
Outdated
Show resolved
Hide resolved
0532835 to
a6e6527
Compare
- revert unsealing trait - add unit test for forwarding unknown messages
- this was an unnecessary addition; I refactored the peerswap plugin to use GetPeerInfo and forward directly to the remote peer instead
a6e6527 to
510b695
Compare
These changes are a prerequisite for the PeerSwap plugin.
This PR introduces a potentially breaking change to existing plugins by changing how the codec parses unknown messages.
Custom Lightning Messages were previously assumed to be prepended with two-bytes for the size of the unknown message blob. Now unknown messages are assumed to be sent as just the custom message type followed by a blob of data, with no assumption that the first two bytes give the size of the following blob.
Unknown Lightning Messages sent to a channel will be forwarded to the channel peer if they are listed as a custom message used by a loaded plugin.
The change to
unknownMessageCodeccausedchannelUpdateCodecWithTypeto incorrectly return success with anUnknownMessage, instead of failure. This was solved by using just theLightningMessageCodecinstead ofmeteredLightningMessageCodecwhich fell back toUnknownMessagefor invalid messages.I also unsealed
TransactionWithInputInfoso that plugins can usecheckSpendablewith custom on-chain transactions.