Commit Graph

66 Commits

Author SHA1 Message Date
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
2bcff188e8 lncli: Add graphical output of routing table
LIGHT-131, LIGHT-140, LIGHT-138
`lncli showroutingtable` may output routing table as image.
Use graphviz for graph rendering.
Add explicit version dependency for tools. Add error checking.
2016-09-06 20:06:51 -04:00
BitfuryLightning
d8bceb16f9 routing: Fix bugs with not sending routing messages
LIGHT-138, LIGHT-141. Due to some issues in sending/receiving parts of lnd,
messages with zero length are not sent. So added some mock content to
NeighborAck. Moved sender/receiver from routing message to wrap message
which contains lnwire routing message.
2016-09-06 20:01:21 -04:00
BitfuryLightning
b5f07ede46 lncli: Make output of lncli sane and readable
LIGHT-133, LIGHT-138 Make output of `lncli showrouting table` in
two different formats: table and json.
Instead of sending serialized routing table send list of channels.
2016-09-06 20:01:21 -04:00
Olaoluwa Osuntokun
c0d59a2d85
lnwire: rename routing files to match current naming conventions
This commit drops the “_message” at the end of each of the newly added
routing files.
2016-08-11 11:54:56 -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
0b86c01067
lnwire: fix CommitSignature max payload length
This commit increase the max allowed payload length for the
CommitSignature method in order to account for the added 8 byte log
index.
2016-07-12 17:07:40 -07:00
Olaoluwa Osuntokun
c8de0924ba
lnwire: properly display channel points in .String() methods 2016-07-12 17:05:18 -07:00
Olaoluwa Osuntokun
6dcefac868
lnwire: update CommitRevocation for revoke key scheme
With this commit a revocation message now carries 3 items:

  1. A pre-image revoking the lowest unrevoked commitment transaction
in the commitment chain.
  2. A new key which extends the current revocation window by 1. This
key is to be used for new commitment transactions.
  3. A new hash which also extends the current revocation window by 1.
This hash is to be used for new HTLC revocation hashes.
2016-06-30 11:59:46 -07:00
Olaoluwa Osuntokun
7c7ed5e638
lnwire: add a LogIndex field to CommitSignature
This commit updates the CommitSignature message to match the latest
version of the state-machine protocol. The log index specifies up to
which index in the receiver’s HTLC log the sender’s signature covers.
2016-06-30 11:58:39 -07:00
Olaoluwa Osuntokun
bba9b665ef
lnwire: all hashes within the protocol are now 32-bytes
We now enforce that the site of all revocation pre-images+hashes (used
for HTLC’s) are now 32-bytes.

Additionally, all payment pre-images are now required to be 32-bytes
not he wire. There also exists a Script level enforcement of the
payment pre-image size at a lower level.

This commit serves to unify the sizes of all hashes/pre-images across
the codebase.
2016-06-30 11:53:21 -07:00
Olaoluwa Osuntokun
fd02c1c1aa
lnwire: update single funder workflow to use revocation keys
This commit updates the messages sent during a single funder workflow
to utilize revocation keys rather than revocation hashes. This now
matches the latest updates to the commitment transaction.

The changes to the workflow are as follows:
  * the response message now carries the responder’s revocation key
  * the complete message now carries the initiator’s revocation key

Once the initiator receives the response message, it can construct both
versions of the commitment transaction as it now knows the responder’s
commitment key. The initiator then sends their initial revocation key
over to the responder allowing it to construct the commitment
transactions and give the initiator a sig for their version.
2016-06-30 11:50:27 -07:00
Olaoluwa Osuntokun
3c11006b12
lnwire: add forgotten godoc comment for SFR 2016-06-21 13:13:10 -07:00
Olaoluwa Osuntokun
6c7880ef76
lnwire: channels are now identified by outpoint
This commit modifies most of the wire messages to uniquely identify any
*active* channels by their funding output. This allows the wire
protocol to support funding transactions which open several channels in
parallel.

Any pending channels created by partial completion of the funding
workflow are to be identified by a uint64 initialized by both sides as
follows: the initiator of the connection starts from 0, while the
listening node starts from (1 << 63). These pending channel identifiers
are expected to be monotonically increasing with each new funding
workflow between two nodes. This identifier is volatile w.r.t to each
connection initiation.
2016-06-21 13:13:07 -07:00
Olaoluwa Osuntokun
3b6e456371
lnwire: revamp previous encode/decode tests to passing state 2016-05-30 20:52:25 -07:00
Olaoluwa Osuntokun
83b11c5efe
lnwire: fix writeElement [][20]byte bug
Passing the [20]byte as a *[20]byte results in a type switch error as
there isn’t a case for that type within writeElement.
2016-05-30 20:52:17 -07:00
Olaoluwa Osuntokun
4d763e07f7
lnwire: add basic encode/decode tests for single funder workflow 2016-05-30 20:52:13 -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
913ae259de
lnwire: document commitment+HTLC update msgs
This commit adds some cursory documentation along wit minor field
modifications to all messages which deal with adding HTLC’s, or
updating remote commitment transactions.

The messages for dual funding of channel is left purposefully
undocumented as all initial negotiations will be single funder by
default.

A revamp of the testing infrastructure of lnwire will be committed in
the near future.
2016-05-23 13:54:41 -07:00
Olaoluwa Osuntokun
b202831868
lnwire: update/document [read/write]Element funcs 2016-05-23 13:51:26 -07:00
Olaoluwa Osuntokun
2073fa42a7
lnwire: document lnwire specific data structures 2016-05-23 13:50:39 -07:00
Olaoluwa Osuntokun
a30831aef8
lnwire: update and document message.go 2016-05-23 13:49:14 -07:00
Olaoluwa Osuntokun
0563205e6d
lnwire: update isValidPkScript for segwit scripts 2016-05-23 13:48:17 -07:00
Olaoluwa Osuntokun
8dc284db02
lnwire: update tests to new wire.TxIn API
Syncing to match upstream btcd segwit branch.
2016-05-23 13:47:29 -07:00
Olaoluwa Osuntokun
1a617fcccb
lnwire: add SingleFundingOpenProof message
The SFOP is the final message sent during the single funding channel
negotiation protocol. Once Alice sends the SFOP message to Bob, Bob
will then commit resources to watching and updating the newly created
channel with Alice.
2016-05-23 13:46:48 -07:00
Olaoluwa Osuntokun
18314f73ae
lnwire: document and update SingleFundingResponse 2016-05-23 13:46:26 -07:00
Olaoluwa Osuntokun
3bf2d62035
lnwire: document start of single funder workflow
This commit adds some additional documentation in the form of comments
to the start of the revised single funder workflow.

A primary change lies in the introduction of the exchange of Channel
Derivation Points (CDP’s) for both sides. Using CDP’s we can derive
channel authentication proofs which are both unforgettable and binding.
2016-05-23 13:40:45 -07:00
Olaoluwa Osuntokun
f799ff3b66
lnwire: add SingleFundingSignComplete msg to workflow
This commit adds the SingleFundingSignComplete message to the single
funder transaction workflow. This marks the second to last message sent
in the workflow. The message transports Bob’s signature for the
commitment transaction, allowing Alice to broadcast the funding
transaction as she can now refund her inputs.
2016-05-22 22:29:52 -07:00
Olaoluwa Osuntokun
59a65518c1
lnwire: add SingleFundingComplete to single funder
This commit adds the SingleFundingComplete message to the single funder
channel workflow. This is the 3rd message sent in the workflow,
traveling from Alice to Bob once Alice is able to construct the final
commitment transaction.
2016-05-22 22:25:52 -07:00
Joseph Poon
566bf47cbf Wire update
More in sync with other code! :D
2016-05-17 21:28:42 -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
5218dca5b6 Simplified the commitment messages 2016-04-11 00:55:48 -07:00
Joseph Poon
48667bdcbe Updated Commit Revocation 2016-03-17 16:51:30 -07:00
Joseph Poon
4b8a8f410a Commit message update
Doesn't need to use a list, only needs to show each party's most recent
state.
2016-03-15 16:22:41 -07:00
Joseph Poon
bf4b43d3f2 Updated coin amounts to use int64
(currently for convenience on development)
2016-02-29 00:45:38 -08:00
Tadge Dryja
2367300d71 Merge branch 'uspvdev' 2016-02-26 13:23:00 -08:00
Joseph Poon
e940e92823 Updated wire to use int64 2016-02-18 04:29:08 -08:00
Tadge Dryja
0d3639435f can sync with segnet in hard mode
lots of changes but they seem to work
2016-02-15 22:13:17 -08:00
Joseph Poon
f2a1c0368a Cleanup comments & removed notes on escrow 2016-01-16 17:14:35 -08:00
Joseph Poon
84c0f56330 lnwire/README.md: Hopefully this will be legible 2016-01-16 17:11:04 -08:00
Joseph Poon
f3ce558eb1 typo fix 2016-01-14 23:58:05 -08:00
Joseph Poon
5fc1ff52fc Typo correction 2016-01-14 23:58:04 -08:00
Joseph Poon
1981001a29 Started working on state machine
* Added description in lnwire/README.md for state machine
* Figured out mutex stuff...
* Started the State Machine (using dummy functions for net/db)
* Minor corrections in wire protocol (changed some names/types)
    - Renamed StagingID to HTLCKey of type HTLCKey (uint64)
2016-01-14 23:58:04 -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
84df87255f Oops typo 2016-01-14 23:56:09 -08:00