Commit Graph

64 Commits

Author SHA1 Message Date
Conner Fromknecht
6ffe33f01a lnw+ba+utxon+cdb: reverts OutPoint and TxOut encoding 2017-08-25 17:56:50 -07:00
Philip Hayes
f0aa186a56 channeldb+utxonursery+lnwire: use lnwire's OutPoint,TxOut serialization 2017-08-25 17:56:50 -07:00
Olaoluwa Osuntokun
2b2a3714c1
multi: fix linter errors 2017-08-22 01:00:12 -07:00
Olaoluwa Osuntokun
96696ccd99
lnwire: update node alias type to respect utf8, use full 32 bytes 2017-08-22 00:51:56 -07:00
Olaoluwa Osuntokun
05d05ac5ee
lnwire: introduce new lnwire.MilliSatoshi type
This commit adds a new type to the lnwire package: MilliSatoshi. A
milli-satoshi is simply 1/1000th of a satoshi, and will be used for all
internal accounting when sending payments, calculating fees, updating
commitment state, etc. Two helper methods are added: ToBTC(), and
ToSatoshis() to make manipulation of the values easy.
2017-08-22 00:51:48 -07:00
Olaoluwa Osuntokun
be67bd46cd
lnwire: add a case for a slice of signatures to readElement/writeElement
This commit modifies the readElement and writeElement functions to add
the capability of reading/writing a slice of btcec.Signature. This new
case is required for the upcoming commit which will modify the
CommitSig message to include a field which houses signatures of reach
HTLC on the commitment transaction.
2017-07-30 17:47:40 -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
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
08a95ead6a
lnwire: remove the CreditsAmount definition, will be replaced with MilliSat 2017-04-19 16:19:14 -07:00
Olaoluwa Osuntokun
f4e8aa21b8
lnwire: enforce a max limit on an outpoint's index
This commit implements the constraint on an outpoint’s index as defined
within the specification.
2017-04-19 16:18:36 -07:00
Olaoluwa Osuntokun
9324a503c9
lnwire: allow up to 35-bytes in pkScripts to account for P2WSH 2017-04-19 16:04:46 -07:00
Olaoluwa Osuntokun
8081fab8fe
lnwire: remove unused types from readElement/writeElement 2017-04-19 16:04:27 -07:00
Olaoluwa Osuntokun
920fcf3392
lnwire: modify newAlias to no longer return an error 2017-04-19 14:59:22 -07:00
Olaoluwa Osuntokun
feec611531
lnwire+peer: implement new ping/pong messages and behavior
This commit implements the new ping/pong messages along with their new
behavior. The new set of ping/pong messages allow clients to generate
fake cover traffic as the ping messages tells the pong message how many
bytes to included and can also be padded itself.
2017-04-16 18:11:45 -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
Olaoluwa Osuntokun
c06894a2e6
lnwire: replace ChannelPoint with ChannelID, use new PendingChanID 2017-04-16 15:22:27 -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
Olaoluwa Osuntokun
afe77853b7
server+lnwire: pre-allocate address slices 2017-03-29 19:00:31 -07:00
bryanvu
9ffac9eae1 lnwire: update NodeAnnouncement to handle multiple addresses
This commit modifies address handling in the NodeAnnouncement struct,
switching from net.TCPAddr to []net.Addr. This enables more flexible
address handling with multiple types and multiple addresses for each
node. This commit addresses the first part of issue #131 .
2017-03-29 12:03:43 -07:00
Andrey Samokhvalov
fd97a4bd19 lnd: partially fix golint warnings 2017-03-13 16:30:23 -07:00
Andrey Samokhvalov
143a6e01bb lnd: fix unconvert warnings 2017-03-13 16:30:23 -07:00
Christopher Jämthagen
46d23919e7 lnwire: add serializing and deserializing for type [6]byte
and remove serialization for type [4]byte.
2017-02-22 15:46:59 -08: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
ccbbcf389b
lnwire: directly embed the wire.OutPoint in all commitment update msgs 2017-02-21 01:42:35 -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
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
Trevin Hofmann
40c7bac3aa multi: fix a variety of typos throughout the repo 2017-01-17 17:02:56 -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
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
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
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
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
Olaoluwa Osuntokun
1ef218a73d
lnwire: add the state hint obsfucator to the SingleFundingComplete msg 2016-11-14 19:04:03 -08:00
Olaoluwa Osuntokun
afae7aad2a
lnwire: add concrete error type to ErrorGeneric 2016-10-23 13:41:23 -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
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
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
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
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
0563205e6d
lnwire: update isValidPkScript for segwit scripts 2016-05-23 13:48:17 -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
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