Commit Graph

335 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
5ebaf9d1e7
routing: vertexes are now serialized pub keys instead of pubkey hashes 2016-09-21 19:48:35 -07:00
Olaoluwa Osuntokun
39c9dfb9e4
config: add a new --debughtlc config parameter
This commit adds a new configuration parameter to the deamon:
‘DebugHTLC’. When true, all outgoing HTLC’s sent via the RPC interface
will be sent paying to a special rHash value which all lnd nodes also
with the flag activated know the preimage to. Therefore all payments
sent to a 1-hop node will immediately be settled by that node.

By default, this flag is false, it it only intended to be used to
exercise local changes to 1-hop behavior manually.
2016-09-21 19:48:25 -07:00
Olaoluwa Osuntokun
0c4293ba82
lnd: extend the invoiceRegistry to wrap on-disk invoices with an in-memory cache
This commit extends the existing invoiceRegistry functionality to wrap
the on-disk invoices available via the channeldb with an in-memory
cache on invoices. Currently the in-memory cache is only reserved for
the storage of special “debug” invoices which all nodes are able to
settle immediately.
2016-09-21 19:48:22 -07:00
Olaoluwa Osuntokun
6c83f53206
rpcserver: allow targeting open channels via global lightning ID
This commit adds the ability to open channels according a node’s
“global” lightning ID in addition to the local relative peer ID.
2016-09-13 15:35:48 -07:00
Olaoluwa Osuntokun
bfa2a1d698
lnd: introduce the utxoNursery which incubates outputs until maturity
This commit introduces the utxoNursery. The duty of the utxoNursery is
to watch over CSV-locked immature outputs until they’ve fully matured.
An output is mature once both its sequence lock indicated by the CSV op
code within its output has become active. Once an output is mature the
nursery sweeps the outputs in batches into the source wallet.

The utxoNursery executes its duties once a commitment transaction has
been broadcast on-chain.
2016-09-12 19:07:39 -07:00
Olaoluwa Osuntokun
d0353b2864
lnwallet: add ability to trigger a force closure within channel state machine
This commit introduces the concept of a manually initiated “force”
closer within the channel state machine. A force closure is a closure
initiated by a  local subsystem which broadcasts the current commitment
state directly on-chain rather than attempting to cooperatively
negotiate a closure with the remote party.

A force closure returns a ForceCloseSummary which includes all the
details required for claiming all rightfully owned outputs within the
broadcast commitment transaction.

Additionally two new publicly exported channels are introduced, one
which is closed due a locally initiated force closure, and the other
which is closed once we detect that the remote party has executed a
unilateral closure by broadcasting their version of the commitment
transaction.
2016-09-12 19:07:35 -07:00
Olaoluwa Osuntokun
a28cf3fdf8
lnd: obtain the identity key via the wallet's GetIdentityKey method 2016-09-08 12:25:58 -07: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
Olaoluwa Osuntokun
1b682b0f40
lnd: update server initialization due to ChainNotifier changes
This commit modifies the daemon’s initialization within the `lndMain`
method to create an instance of the current default ChainNotifier
outside of the LightningWallet.

At this point, since there are no other implementations of the
ChainNotifier, the current concrete implementation BtcdNotifier is used
by default. In the future, once other ChainNotifier implementations are
in place, config parsing should be fed into a factory function which
creates the proper ChainNotifier implementation.

Finally, several imports have been updated to reflect the change in
package name.
2016-09-01 19:13:27 -07:00
Olaoluwa Osuntokun
832fd248cd
lnd: add async updates for [open|close]channel RPC's
This commit modifies the internal workflow for opening or closing a
channel in order to create a path in which RPC clients can receive
updates. Updates are now communicated via channels from the goroutines
spawned by the RPC server to process the request, and the sub-system
within the daemon that actually executes the request.

With this change clients can now receive updates that the request is
pending (final message has been sent to the target client), or that the
request has been completed. Confirmation related updates have not yet
been implemented as that will require some changes to the ChainNotifier
interface.
2016-08-30 16:53:07 -07:00
Olaoluwa Osuntokun
4bc315d061
lnd: minor clean up with comments + go fmt after latest PR merge 2016-08-11 11:56:03 -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
c0614c0478
lnwallet: add basic tests for cooperative channel closure
This commit adds a basic test for cooperative channel closure. The
current test ensures correctness of the cooperative closure procedure
initiated by either the channel initiator, or the channel responder.
2016-07-27 11:32:35 -07:00
Olaoluwa Osuntokun
2a57f9182a
lndc+lnd: fix panic when connecting to multiple peers, plus duplicate conn detection 2016-07-16 18:01:05 -07:00
Olaoluwa Osuntokun
b9c29ad9fc
lnd: consolidate peerManager and queryHandler 2016-07-13 16:34:27 -07:00
Olaoluwa Osuntokun
e1d5878df4
lnd: introduce the InvoiceRegistry
This commit introduces the invoice registry which is a central
repository of all outstanding invoices related to the daemon.

This registry will be used by the goroutines which manage the htlc’s
for a particular channel, and later by the point-to-point workflow
which negotiates the conditions for payment along with signed recipes.
2016-07-12 17:14:16 -07:00
Olaoluwa Osuntokun
5fab6ea39e
lnd: redirect channel closure reqs from server to htlcSwitch 2016-07-09 16:36:31 -07:00
Olaoluwa Osuntokun
c0383679d2
lnd: use asynchronous streaming responses for [open|close]channel RPC's
This commit switches the implementation of the open/close channel RPC’s
from a fully blocking synchronous model to one that’s async by default,
allowing callers to add a sync wrapper.

The new proto specs also allow for “updates” for the pending channels
in the form of new confirmations which progress the pending status of
the channel. At this point, only the final open/close updates have been
implemented. Obtaining confirmation notifications requires a bit of
re-working within the current ChainNotifier interface, thus this has
been deferred to a later time.
2016-07-07 15:31:07 -07:00
Olaoluwa Osuntokun
2512fecf88
lnd: populate lightning id within server 2016-07-05 18:49:08 -07:00
Olaoluwa Osuntokun
1188fd2bf6
lnd: implement open+close channel workflow in daemon
This commit adds the necessary plumbing within the server, peer, and
rpcServer to handle opening and cooperatively closing a channel with a
remote peer.

Many new data structures have been added to the peer in order to allow
it to efficiently manage opening+.losing new/existing lightning
channels. Additional documentation has been added to several methods
within the peer struct, with some minor renaming along with way. The
peer has also gained a dedicated goroutine whose job it is to manage
any requests pertaining to opening, or closing any channels with the
remote peer.

The messages have been added to lnrpc define the requests and responses
to channel open+close messages. Additional channel logic has been added
between the rpcServer, peer, and server in order to properly manage the
necessary synchronization.
2016-06-21 13:14:05 -07:00
Olaoluwa Osuntokun
9ef7e23384
lnd: implement connectpeer and listpeers RPC calls 2016-06-21 13:14: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
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
Olaoluwa Osuntokun
9982bf4c33 use lnwallet's Shutdown method instead of btcwallet's inner Stop 2016-04-24 12:40:40 -07:00
Olaoluwa Osuntokun
1dfe344c4d p2p listener should only log an error if not shutting down 2016-04-24 12:40:23 -07:00
Olaoluwa Osuntokun
555003006b add WaitForShutdown method to the server, additional logging 2016-03-22 18:49:22 -07:00
Tadge Dryja
dd2c2274c8 export fields from lnid and add deserialization method 2016-01-19 00:05:02 -08:00
Tadge Dryja
b0a402bc4f remove ID private key from LNDConn struct 2016-01-17 11:20:40 -08:00
Tadge Dryja
9e5f302288 move lnadr from main to lndc package 2016-01-17 10:45:07 -08:00
Olaoluwa Osuntokun
9a775cf66e add functionality to server for manually establishing outgoing connections 2016-01-16 19:28:19 -08:00
Olaoluwa Osuntokun
1f1b82fe3f add constructor for core server struct 2016-01-16 19:28:16 -08:00
Olaoluwa Osuntokun
7ecbb2debc move getPriv to server.go, and rename 2016-01-16 19:27:20 -08:00
Tadge Dryja
d47105217b change imports to github.com/lightningnetwork/lnd 2016-01-16 10:38:48 -08:00
Olaoluwa Osuntokun
0c304cbb2f Flesh out the peer handling skeleton within peer/server 2016-01-14 23:58:04 -08:00
Olaoluwa Osuntokun
a10a678505 add some daemon related skeleton files 2015-12-26 00:09:17 -06:00