Commit Graph

18 Commits

Author SHA1 Message Date
eugene
7ff04d8bad
lnwire: remove MaxPayloadLength from Message interface
Removes the MaxPayloadLength function from the Message interface
and checks that each message payload is not greater than MaxMsgBody.
Since all messages are now allowed to be 65535 bytes in size, the
MaxPayloadLength is no longer needed.
2021-03-04 16:48:10 -05:00
Olaoluwa Osuntokun
9a6bb19770
lnwire: prep wire messages for TLV extensions
Messages:
- UpdateFulfillHTLC
- UpdateFee
- UpdateFailMalformedHTLC
- UpdateFailHTLC
- UpdateAddHTLC
- Shutdown
- RevokeAndAck
- ReplyShortChanIDsEnd
- ReplyChannelRange
- QueryShortChanIDs
- QueryChannelRange
- NodeAnnouncement
- Init
- GossipTimestampRange
- FundingSigned
- FundingLocked
- FundingCreated
- CommitSig
- ClosingSigned
- ChannelUpdate
- ChannelReestablish
- ChannelAnnouncement
- AnnounceSignatures

lnwire: update quickcheck tests, use constant for Error

multi: update unit tests to pass deep equal assertions with messages

In this commit, we update a series of unit tests in the code base to now
pass due to the new wire message encode/decode logic. In many instances,
we'll now manually set the extra bytes to an empty byte slice to avoid
comparisons that fail due to one message having an empty byte slice and
the other having a nil pointer.
2021-02-24 17:31:55 +01:00
nsa
cbd54101f8 multi: remove peer.go, change all references to point to peer pkg 2020-07-06 19:16:07 -04:00
Conner Fromknecht
2df5a36048
peer+lnwire: add LinkUpdater iface and impl on relevant msgs
Removes longstanding TODO to simplify parsing of target chanid.
2019-09-25 12:00:59 -07:00
Olaoluwa Osuntokun
4226232881
lnwire: export ReadElements and WriteElements
In this commit, we export the ReadElements and WriteElements functions.
We do this as exporting these functions makes it possible for outside
packages to define serializations which use the BOLT 1.0 wire format.
2018-12-24 19:58:06 -06:00
practicalswift
663c396235 multi: fix a-vs-an typos 2018-04-17 19:02:04 -07:00
Olaoluwa Osuntokun
1d1f9f1724
lnwire: update onion error encoding/decoding to match BOLT-0004
This commit updates the encoding/decoding for the onion errors to
properly match BOLT-0004. This commit does to major things: we increase
the max message size to 256 bytes to account for recent modifications
to the ChannelUpdate message, and also fold in the error code into the
failure message encapsulation itself.
2017-08-22 00:51:53 -07:00
Andrey Samokhvalov
98956bc2fe lnwire: add specification onion errors
In this commit onion routing error from BOLT#4 have been added, the
initial error construction have been splitted on two parts: The first
part which contains the actual data will reside inside the lnwire
package because it contains all necessary function to decode/encode
the data. The second part obfuscation and hmac checking will resides
inside the lighting-onion package because it requires the key
generation.
2017-07-14 19:08:04 -07:00
Andrey Samokhvalov
b86409cdb3 htlcswitch: recreate hlcswitch from scratch
This commit gives the start for making the htlc manager and htlc switch
testable. The testability of htlc switch have been achieved by mocking
all external subsystems. The concrete list of updates:

1. create standalone package for htlc switch.
2. add "ChannelLink" interface, which represent the previous htlc link.
3. add "Peer" interface, which represent the remote node inside our
subsystem.
4. add htlc switch config to htlc switch susbystem, which stores the
handlers which are not elongs to any of the above interfaces.

With this commit we are able test htlc switch even without having
the concrete implementation of Peer, ChannelLink structures, they will
be added later.
2017-05-31 11:06:08 -07:00
Andrey Samokhvalov
84f94bdf4f lnwire: add reason to fail code conversion method 2017-05-31 11:06:08 -07:00
Olaoluwa Osuntokun
f6b3c25f95
lnwire: on Message interface convert Command to MsgType
This commit modifies the Message interface to convert the Command
method to a MsgType method that uses a new set of message type for all
the defined messages. These new messages types nearly exactly match the
message types used within the current draft of the BOLT specifications.
2017-04-19 15:57:50 -07:00
Olaoluwa Osuntokun
c8d978261b
lnwire: remove the Validate method from the Message interface
This commit revues the Validate method from the Message interface as
the method is no longer used and is a relic from an older version of
the codebase.
2017-04-19 15:03:51 -07:00
Olaoluwa Osuntokun
c06894a2e6
lnwire: replace ChannelPoint with ChannelID, use new PendingChanID 2017-04-16 15:22:27 -07:00
Andrey Samokhvalov
fd97a4bd19 lnd: partially fix golint warnings 2017-03-13 16:30:23 -07:00
Andrey Samokhvalov
8fb54782e2 lnd: fix gosimple warnings 2017-03-13 16:30:23 -07:00
Olaoluwa Osuntokun
8024fd72f8
lnwire: create distinct type for UpdateFailHTLC failure reason
This commit creates a distint type for the opaque failure reason within
the UpdateFailHTLC message. This new type is needed as this is the only
variable length byte slice within the protocol and therefore requires a
length prefix in order to serialize/deserialize properly.
2017-02-21 01:43:36 -08:00
Olaoluwa Osuntokun
4aa7de7f58
lnwire: remove obsolete String() method from new wire messages 2017-02-21 01:43:34 -08:00
Olaoluwa Osuntokun
f1357e96b3
lnwire: morph CancelHTLC into UpdateFailHTLC, remove HTLCAddReject
This commit morphs the prior CancelHTLC into the new UpdateFailHTLC
message and also gets rid of the obsolete HLTCAddReject message while
we’re at it.

The primary change from the CancelHTLC message to the UpdateFailHTLC
message is that the CancelReason is now simply called Reason and that
it’s now an opaque encrypted set of bytes. With this update the failure
messages are now more flexible (they can even carry new
ChannelUpdate’s) and also don’t reveal the exact cause of failure to
intermediate nodes.
2017-02-21 01:42:29 -08:00