Commit Graph

104 Commits

Author SHA1 Message Date
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
Trevin Hofmann
a13ac90d46 multi: add link to LICENSE in README license badges (#100) 2017-01-12 16:31:08 -08:00
Christopher Jämthagen
95888613d0 multi: minor fixes for README's 2017-01-11 15:50:22 -08:00
Olaoluwa Osuntokun
4ccdad0d66
multi: add README's for all sub-packages 2017-01-10 15:02:37 -08:00
Olaoluwa Osuntokun
35776a9906
lnwire: add new 'PushSatoshis' field to SingleFundingRequest
This commit adds a new paramter to the initial channel creation:
‘PushSatoshis’. This new field allows the funder of a channel to push
over a certain amount to the responder as part of the initial channel
state. This ability creates a new streamlined UX of finalizing a
payment as a part of the channel creation.
2017-01-09 17:24:32 -08:00
Olaoluwa Osuntokun
81767eb8fd
lnwire: add IncorrectValue as HTLC error type, fix typos
This commit adds a new HTLC error type: IncorrectValue. This error type
is to be used when an HTLC that’s extended to the final destination
does not match the expectation of the destination.
2017-01-07 21:21:58 -08:00
Olaoluwa Osuntokun
d079c88702
lnwire: add cancellation reason to htlc cancel messages
This commit adds a new field to the CancelHTLC message which describes
the event that led to an HTLC being cancelled up stream.

A new enum has been added which describers the “why” concerning the
cancellation of the HTLC. Currently the encoding and back propagation
of the errors aren’t properly implemented as defined within the spec.
As a result the current error types provide to privacy as the error are
in plain-site rather doing being properly encrypted.
2017-01-07 21:20:54 -08:00
Olaoluwa Osuntokun
5affed38fc
multi: update btcsuite API's to latest upstream changes
This commit makes a large number of minor changes concerning API usage
within the deamon to match the latest version on the upstream btcsuite
libraries.

The major changes are the switch from wire.ShaHash to chainhash.Hash,
and that wire.NewMsgTx() now takes a paramter indicating the version of
the transaction to be created.
2017-01-05 13:56:34 -08:00
Olaoluwa Osuntokun
98471256fa
lnwire: modify fundingOpen to include channel ID rather than SPV proof
This commit modifies the SingleFundingOpen message to include the
compact channel ID of the finalized transaction rather than a “fake”
SPV proof. This change is a stop-gap which allows us to implement
portions of BOLT07 without yet fully implementing all parts of BOLT[02,
03].
2016-12-27 16:44:25 -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
Olaoluwa Osuntokun
78ce39692e
lnwire: remove channel graph announcement validation tests
This commit removes the previous test cases which excised the proper
validation of graph announcements on the network. As full generation of
the authenticated messages has not yet been implemented, these tests
aren’t currently applicable.

In a future commit, these tests will be replicated on the new discovery
package which will handle producing the channel proofs and also fully
validating them.
2016-12-27 16:43:48 -08:00
Olaoluwa Osuntokun
e5490b55f4
lnwire: modify Alias to only track the non-zero portion of wire msg
This commit modifies the Alias type to only hold the non-zero portion
of the alias as encoded on the wire. Previously the entire 32-bytes
would be read and stored, including the zeroes at the end used as
padding. Within the constructor, we now parse the alias properly,
discarding the trailing zeroes within the passed byte slice.
Additionally, the .String() method of Alias will now also only print
the non-zero prefix of the decoded alias.
2016-12-27 16:43:46 -08:00
Olaoluwa Osuntokun
16388aba00
lnwire: temporarily disable chan/node announcement validation
This commit temporarily disables the signature validation for all
announcement related messages which should be authenticated by one or
many parties. This feature is being disabled as we don’t yet generate
valid signatures for our advertisements and the validation of the
messages should be placed in the layer 3 discovery service rather than
within within the message parsing layer.
2016-12-27 16:43:44 -08:00
Olaoluwa Osuntokun
1b0a0b6538
lnwire: add tests to check payload estimates for channel announcements 2016-12-27 16:43:39 -08:00
Olaoluwa Osuntokun
3dc8cd5659
lnwire: correct max payload estimate for NodeAnnouncement, add test 2016-12-27 16:43:36 -08:00
Olaoluwa Osuntokun
3d32c4e90e
lnwire: separate ChannelID into a distinct struct, add tests
This commit separates out the ChannelID into a new file, with
additional helper methods for conversion and formatting. With this
commit, the struct is now more general purpose and can be used in the
new routing package, database, and other related sub-systems.
2016-12-27 16:43:24 -08:00
Olaoluwa Osuntokun
5ee201e712
lnwire: embed ChannelID within the announcement structs rather than pointer 2016-12-27 16:43:21 -08:00
Andrey Samokhvalov
b440005219
lnwire: add ChannelAnnoucement,NodeAnnoucement,ChannelUpdateAnnoucement messages 2016-12-27 16:43:02 -08:00
Andrey Samokhvalov
c731156ac8 lnwire: add DustLimit to SingleFundingRequest and SingleFundingResponse 2016-12-13 11:01:57 -08:00
Andrey Samokhvalov
5a82240c6a lnwire+lnwallet+fundingmanager: general improvements 2016-12-13 11:01:57 -08:00
Alex Akselrod
a20594b0bf lnwire: switch to using a fixed 64-byte encoding for signatures (#86)
This commit modifies the encoding of signatures on the wire to use 
a fixed-size 64-byte format. This change is required as the current spec
draft dictates that all signatures be encoded as `R` and `S` as 32-byte
big-endian integers. With this, signatures are now always a _fixed_ size 
slice of bytes on the wire, which is nice to have. 

Fixes #83.
2016-12-08 12:56:37 -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
Andrey Samokhvalov
391d5cd401 lnwallet: add commitment transaction estimation 2016-11-23 20:02:29 -06:00
Andrey Samokhvalov
5b9e4ae61e general: fix typos, rename variables, add comments 2016-11-23 20:02:29 -06:00
Olaoluwa Osuntokun
1ef218a73d
lnwire: add the state hint obsfucator to the SingleFundingComplete msg 2016-11-14 19:04:03 -08: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
f12b9b4bd7 Merge pull request #66 from AndrewSamokhvalov/temporary_fix_multihop
Temporary fix multihop
2016-11-08 14:58:01 -08:00
Olaoluwa Osuntokun
1855b95558
lnwire: modify NetAddress to implement the net.Addr interface
This commit modifies lnwire.NetAddress by adding a .Network() method.
With this added method the struct now implements the net.Addr interface
meaning that it can now be transparently passed into any context where
a net.Addr is requested.

This change paves the way to integration of btcd’s new connmgr into the
daemon to handle establishing persistent connections to all channel
counter parties.
2016-11-07 18:18:20 -08:00
Andrey Samokhvalov
8dcf274a2d fix typos 2016-10-30 17:54:59 +03:00
Olaoluwa Osuntokun
f37956e38e
routing: update Sphinx API to include r-hash and per-hop-payload
This commit modifies both the Sphinx packet generation and processing
for recent updates to the API.

With the version 1 Sphinx specification, the payment hash is now
included in the MACs in order to thwart any potential replay attacks.
As a result, any attempts to replay previous HTLC packets MUST re-use
the same payment hash, meaning that the first-hop node can simply
settle the HTLC immediately, thwarting the attacker.

Additionally, within the Sphinx packet, each hop now gets a per-hop
payload which contains the necessary details (CTLV value, fee, etc) for
the node to successfully forward the payment. This per-hop payload is
protected by a packet-wide MAC.
2016-10-27 20:40:26 -07:00
Olaoluwa Osuntokun
5c751ec1df
lnwire: add a field to indicate bitcoin net to NetAddress 2016-10-27 19:19:58 -07:00
Olaoluwa Osuntokun
99ed3b8616
lnwire: introduce new NetAddress struct for p2p node addr+key info 2016-10-26 18:41:37 -07:00
Olaoluwa Osuntokun
afae7aad2a
lnwire: add concrete error type to ErrorGeneric 2016-10-23 13:41:23 -07:00
Andrey Samokhvalov
7196c4bb1c fundingmanager: add max pending channel check 2016-10-22 02:15:35 +03:00
Andrey Samokhvalov
b0525cf478 wire: add PendingID in ErrorGeneric 2016-10-22 01:48:23 +03:00
Andrey Samokhvalov
14c6770b76 general: fix typos 2016-10-22 01:48:05 +03: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
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