Commit Graph

116 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
ccbbcf389b
lnwire: directly embed the wire.OutPoint in all commitment update msgs 2017-02-21 01:42:35 -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
ae15a193e2 lnwire+features: transition to the user friendly list of features 2017-02-21 01:25:05 -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
384fe61e73
multi: fix go vet warnings throughout code base 2017-02-16 19:33:19 +08:00
Olaoluwa Osuntokun
a658fabf48
funding: disallow channel creation before lnd is synced to the chain
This commit adds a new restriction around funding channels at the
daemon level: lnd nodes will not allow either the initiation or the
acceptance of a channel before the node is fully synced to the best
known chain.

This fixes a class of bug that arises when a new node joins the network
and either attempts to open a channel or has a channel extended to them
before the node is fully synced to the network.
2017-01-24 17:12:57 -08:00
Trevin Hofmann
40c7bac3aa multi: fix a variety of typos throughout the repo 2017-01-17 17:02:56 -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
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