Commit Graph

51 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
50d521ba8c
lnwire: add a case in MessageType.String() for UpdateFee 2017-08-22 00:51:46 -07:00
Olaoluwa Osuntokun
f7800709ba
lnwire: use %v instead of %x when printing length of oversized msg 2017-07-30 17:47:51 -07:00
Olaoluwa Osuntokun
53f45e8210
lnwire: update MessageType definition to include new funding messages 2017-07-30 17:47:48 -07:00
Andrey Samokhvalov
46ba18db9b lnwire: add update_fail_malformed_htlc message
In this commit BOLT#4 specification message have been added to the
lnwire package. This messsage is needed in order to notify payment
sender that forwarding node unable to parse the onion blob.
2017-07-14 19:08:04 -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
Johan T. Halseth
a3836d5241 lnwire: add update_fee message type. 2017-07-14 16:39:15 -07:00
Andrey Samokhvalov
3897343db1 lnwire: add message type description function 2017-05-31 11:06:08 -07:00
bryanvu
d7bb600c23 lnwire: adjusted coop close messages to comply with spec
Removed close_request and close_complete and replaced with shutdown and
closing_signed.
2017-05-23 14:31:20 -07:00
Olaoluwa Osuntokun
994a3c10ca
brontide+lnwire: fix linter issues 2017-04-20 15:50:13 -07:00
Olaoluwa Osuntokun
aa2ca81762
lnwire: modify ReadMessage to no longer return the total bytes read
This commit modifies ReadMessage to no longer return the total bytes
read as this value will now be calculated at a higher level. The
io.Reader that’s passed to ReadMessage is expected to contain the
_entire_ message rather than be a pointer into a stream that contains
the message itself.
2017-04-20 15:45:56 -07:00
Olaoluwa Osuntokun
febc8c399a
lnwire: convert message parsing to use the new minimal type header
This commit abandons our old bitcoin inspired message header and
replaces it with the bare type-only message headers that’s currently
used within the draft specification. As a result the message header now
consists of only 2-bytes for the message type, then actual payload
itself. With this change, the daemon will now need to switch to a
purely message based wire protocol in order to be able to handle the
extra data that can be extended to arbitrary messages.
2017-04-19 16:13:15 -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
bcd142bc30
lnwire: reduce the max message payload to 65KB from 32MB
This commit reduces the max message payload to 65KB from 32MB in order
to better align ourselves with current draft of the BOLT
specifications.
2017-04-19 15:09:18 -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
d17b11862b
lnwire: convert ErrorGeneric to Error
With this change we move one step closer to matching the wire protocol
currently defined within the spec.
2017-04-16 15:23:45 -07:00
Andrey Samokhvalov
c3b2854428 lnwire: converge discovery part of messages with specification
Change the name of fields of messages which are belong to the discovery
subsystem in a such way so they were the same with the names that are
defined in the specification.
2017-03-29 19:49:05 -07:00
Andrey Samokhvalov
54b3541707 lnwire: add specification 'AnnounceSignature' message
In this commit announcement signature message has been added which is
needed when peers want to announce their channel to the rest of the
network. This message acts as half proof carrier, nodes exchanges
their half proofs with each other and after that they are able to
construct the full proof.
2017-03-29 19:49:05 -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
bryanvu
eb490b8833 lnwire: add FundingLocked message
When the funding transaction has been confirmed, the FundingLocked
message is sent by the peers to each other so that the existence of the
newly funded channel can be announced to the network.

This commit also removes the SingleFundingOpenProof message.
2017-02-24 11:37:33 -08:00
Olaoluwa Osuntokun
5330513c7b
lnwire: morph HTLCSettleRequest into UpdateFufillHTLC
This commit modifies the prior HTLCSettleRequest to more closely match
the UpdateFufillHTLC defined within the specification. The only
semantic change is the move from a slice of pre-images (for “multi-sig”
LN) to a single payment preimage.
2017-02-21 01:42:32 -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
Olaoluwa Osuntokun
ec02060c9f
lnwire: rename HTLCAddRequest to UpdateAddHTLC 2017-02-21 01:42:26 -08:00
Olaoluwa Osuntokun
8a63c83283
lnwire: morph CommitSignature into CommitSig
This commit renames and modifies the CommitSignature message to more
closely match the CommitSig message defined within the current set of
draft specifications.

The major change within the new message is that we now longer
explicitly specify the update log index of the remote node that this
signature covers. This is due to the fact the revocation message now
also double as acknowledgements of the remote parties recevied
commitment update messages.
2017-02-21 01:42:23 -08:00
Olaoluwa Osuntokun
9a61bb3ae1
lnwire: rename CommitRevocation to RevokeAndAck
This commit renames the prior CommitRevocation message to RevokeAndAck
in order to better align the set of wire messages implemented by the
`lnwire` message with those currently defined within the specification.
2017-02-21 01:42:09 -08:00
Andrey Samokhvalov
3dd619fb35 lnwire: Add BOLT#1 'init' message
'init' message is the first message reveals the features supported or required
by this node. Nodes wait for receipt of the other's features to simplify error
diagnosis where features are incompatible. This message will help negotioate the
the features which are supported by both sides.
2017-02-17 13:27:29 +08:00
Olaoluwa Osuntokun
f82d957c90
lnwire+peer: introduce new error for unknown message type for forward compat
This commit adds a new error type to the `lnwire` package:
`UnknownMessage`. With this error we can catch the particular case of a
an error during reading that encounters a new or unknown message. When
we encounter this message in the peer’s readHandler, we can now
gracefully handle it by just skipping to the next message rather than
closing out the section entirely.

This puts us a bit closer to the spec, but not exactly as it has an
additional constraint that we can only ignore a new message if it has
an odd type. In a future release, we’ll modify this code to match the
spec as written.
2017-01-16 18:03:43 -08:00
Olaoluwa Osuntokun
d884efea29
lnwire+lnd: Make Logging Messages Great Again
This commit modifies the login of sent/recv’d wire messages in trace
mode in order utilize the more detailed, and automatically generated
logging statements using pure spew.Sdump.

In order to avoid the spammy messages due to spew printing the
btcec.S256() curve paramter within wire messages with public keys, we
introduce a new logging function to unset the curve paramter to it
isn’t printed in its entirety. To insure we don’t run into any panics
as a result of a nil pointer defense, we now copy the public keys
during the funding process so we don’t run into a panic due to
modifying a pointer to the same object.
2017-01-14 17:52:18 -08:00
Olaoluwa Osuntokun
b5dd462e13
lnwire: remove old routing/discovery messages
This commit removes the older routing/discovery messages from the
unwire package, as we’ll be converging towards BOLT07 in the near-term.
In the mid to far term we’ll be revisiting integrating Flare into the
newer scheme in order to take advantage of its scaling characteristics.
2016-12-27 16:44:20 -08:00
Andrey Samokhvalov
b440005219
lnwire: add ChannelAnnoucement,NodeAnnoucement,ChannelUpdateAnnoucement messages 2016-12-27 16:43:02 -08:00
BitfuryLightning
327768f4ad routing: Move tools inside lnd. Refactor and delete unneeded stuff
Use [33]byte for graph vertex representation.
Delete unneeded stuff:
1. DeepEqual for graph comparison
2. EdgePath
3. 2-thread BFS
4. Table transfer messages and neighborhood radius
5. Beacons

Refactor:
1. Change ID to Vertex
2. Test use table driven approach
3. Add comments
4. Make graph internal representation private
5. Use wire.OutPoint as  EdgeId
6. Decouple routing messages from routing implementation
7. Delete Async methods
8. Delete unneeded channels and priority buffer from manager
9. Delete unneeded interfaces in internal graph realisation
10. Renamed ID to Vertex
2016-11-23 20:37:43 -06:00
Olaoluwa Osuntokun
7fc6159f0a
lnwire: re-add .String() to the lnwire.Message interface 2016-11-10 17:48:09 -08:00
Olaoluwa Osuntokun
3f39f5413e
lnwire: add ping and pong messages
This commit adds Ping and Pong messages to the suite of lnwire
messages. The usage of these messages within the daemon are similar to
the usage of Bitcoin’s ping/pong messages. Pings are to be sent
periodically with a random nonce to check connection activity and also
to gauge latency. Pong’s are to be sent in reply to ping messages,
echo’ing the same nonce used.
2016-11-10 17:09:27 -08:00
Olaoluwa Osuntokun
7b953c9c61
rpcserver: add REST workarounds, implement new RPC calls
This commit adds a few workarounds in order to concurrently support the
REST proxy as well as the regular gRPC interface. Additionally,
concrete support for the following RPC calls has been added:
GetTransactions, SubscriptTransactions, SubscribeInvoices, and
NewWitnessAddress.
2016-10-15 14:42:25 -07:00
Olaoluwa Osuntokun
7d0e1576ec
lnwire: remove the HTLC timeout msg in favor of a HTLC cancel msg
This commit removes the previous HTLC timeout in message in favor of a
HTLC cancel message. Within the protocol, a timeout message would never
be sent backwards along the route as in the case of an HTLC timeout
before/after the grace period, the course of action taken would be to
broadcast the current commitment transaction unilaterally on-chain.
2016-09-22 18:51:51 -07:00
BitfuryLightning
f8c851769f multi: initial integration of routing module
This commit integrates BitFury's current routing functionality into lnd. The
primary ochestration point for the routing sub-system in the routingMgr. The
routingMgr manages all persistent and volatile state related to routing within
the network.

Newly opened channels, either when the initiator or responder are inserted into
the routing table once the channel is fully open. Once new links are inserted
the routingMgr can then perform path selection in order to locate an "optimal"
path to a target destination.
2016-08-11 11:20:27 -07:00
Olaoluwa Osuntokun
bdc22e67fa
lnwire: remove obsolete dual funder messages 2016-07-25 16:02:00 -07:00
Olaoluwa Osuntokun
9978d889b7
lnwire: add missing cases in [read/write]Element
Add cases to encode/decode wire.OutPoint, and a final line to properly
write out signatures fully.
2016-05-30 15:45:01 -07:00
Olaoluwa Osuntokun
a30831aef8
lnwire: update and document message.go 2016-05-23 13:49:14 -07:00
Olaoluwa Osuntokun
fcff17c336
multi: change all imports to roasbeef's forks
This commit will allow the general public to build lnd without jumping
through hoops setting up their local git branches nicely with all of
our forks.
2016-05-15 17:22:37 +03:00
Joseph Poon
48667bdcbe Updated Commit Revocation 2016-03-17 16:51:30 -07:00
Joseph Poon
f2a1c0368a Cleanup comments & removed notes on escrow 2016-01-16 17:14:35 -08:00
Joseph Poon
b4c644c99a Added Error message type to wire protocol 2016-01-14 23:56:10 -08:00
Joseph Poon
f3849f5c10 Structs for Wire Protocol HTLCs and Commitments
* Structs and wire messages for HTLCs
* Wire protocol for a state machine with no blocking(!!!)
  (I will write the state machine)
  TL;DR: Can do multiple HTLC modifications in-flight, dead simple wire
  protocol. Both sides can update their Commitments unliaterally without
  waiting for the other party's signature. Will have basic/preliminary
  notes in the README
* Added **swp to .gitignore because of vim annoyances
2016-01-14 23:56:10 -08:00
Tadge Dryja
919b0002b1 put MSGID bytes back in to lnwire 2016-01-14 23:56:09 -08:00
Joseph Poon
8cc057bbd4 Cooperative Close 2016-01-14 23:56:09 -08:00
Joseph Poon
bf8e0d727d Added ReservationID for funding_requeset 2016-01-14 23:56:09 -08:00
Joseph Poon
2d3253b95d Cleanup
* Bugfixes
* Removed whether to include sigs in txin for readElement/writeElement
2016-01-14 23:56:09 -08:00
Joseph Poon
a93b6dcee4 Messages for funding flow.
This is the most different due to segwit (the rest of the messages are
simple).

I still need to simplify/refactor the tests, they're "messy".
2015-12-30 05:38:57 -08:00
Joseph Poon
02a9b1e237 While making things match closely with Rusty's wire protocol, I noticed
he didn't allow for multiple HTLCs. Gotta explain the rationale for that
that... will merge the progress in the next commit tomorrow.
2015-12-29 05:24:02 -08:00