Commit Graph

2077 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
460c2b0ec1
channeldb: update test to match recent API changes 2017-08-22 00:52:28 -07:00
Olaoluwa Osuntokun
76302a136b
channeldb: in node.ForEachChannel return incoming/outgoing edges
This commit modifies the node.ForEachChannel to *also* return the
incoming edge as well as the outgoing edge. We make this modification
as when we’re doing path finding, we need to return the incoming edge
as well, since we need to use the to properly compute the time lock and
fees for transit on that edge.
2017-08-22 00:52:25 -07:00
Olaoluwa Osuntokun
35d9dc8092
channeldb: add ChainHash to ChannelEdgeInfo to match BOLT-0007 2017-08-22 00:52:22 -07:00
Olaoluwa Osuntokun
59aae249dc
channeldb: use lnwire.MilliSatoshi within the ChannelEdgePolicy struct 2017-08-22 00:52:20 -07:00
Olaoluwa Osuntokun
74470cf7d0
channeldb: update ChannelConstraints+OpenChannel to use lnwire.MilliSatoshi 2017-08-22 00:52:17 -07:00
Olaoluwa Osuntokun
251f8d650f
channeldb: update the Invoice struct to use lnwire.MilliSatoshi 2017-08-22 00:52:15 -07:00
Olaoluwa Osuntokun
063525c6e0
channeldb: update the OutgoingPayment struct to use lnwire.MilliSatoshi 2017-08-22 00:52:12 -07:00
Olaoluwa Osuntokun
6e17c34229
lnwallet: update commitScriptToSelf to match BOLT-0003
This commit updates the script we use to match the current
specification. The change is minor: we can say an extra byte by moving
the OP_CHECKSIG to the end of the script, and swapping the checks and
seqverify operations in the second clause. However, the witness remains
the same!
2017-08-22 00:52:09 -07:00
Olaoluwa Osuntokun
f47e7a9bf4
lnwire: update the ChannelAnnouncement message to match BOLT-0007 2017-08-22 00:52:07 -07:00
Olaoluwa Osuntokun
e93197b303
lnwire: add a ChainHash field to ChannelUpdate
This commit adds a ChainHash field to the ChannelUpdate message in
order to ensure that we’re compatible with the recent change to
BOLT-0007.
2017-08-22 00:52:04 -07:00
Olaoluwa Osuntokun
50c679afa3
lnwire: eliminate the ErrorCode field within the Error message
This commit does away with the ErrorCode field in order to ensure that
we’re properly compatible with BOLT-0002. In the future the error code
field may be re-introduced as it’s much easier to check against an
internet error rather than interpret a byte slice describing the error.
2017-08-22 00:52:02 -07:00
Olaoluwa Osuntokun
29af6e6932
lnwire: shift fields in NodeAnnouncment to match recent BOLT-0007 changes
This commit modifies the NodeAnnouncement message to ensure that it
matches the current spec ordering. The spec was recently modified to
place the feature vector first to allow for future changes to the
fields to be forwards compatible.
2017-08-22 00:51:59 -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
1d1f9f1724
lnwire: update onion error encoding/decoding to match BOLT-0004
This commit updates the encoding/decoding for the onion errors to
properly match BOLT-0004. This commit does to major things: we increase
the max message size to 256 bytes to account for recent modifications
to the ChannelUpdate message, and also fold in the error code into the
failure message encapsulation itself.
2017-08-22 00:51:53 -07:00
Olaoluwa Osuntokun
b174ae80bf
lnwire: convert all relevant fields to use the MilliSatoshi type 2017-08-22 00:51:51 -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
50d521ba8c
lnwire: add a case in MessageType.String() for UpdateFee 2017-08-22 00:51:46 -07:00
Olaoluwa Osuntokun
77e3e74ea2
autopilot: for ConstrainedPrefAttachment.Select factor in skipNodes
This commit modifies the Select method for the
ConstrainedPrefAttachment attachment heuristic slightly. Previously, it
was possible for an autopilot.Agent to go over the allotted number of
channels as it would unconditionally attempt to establish channel with
all returned Attachment Directives. To remedy this, we now assume that
we already have active, or pending channels to each of the nodes in the
set of skipNodes. Therefore, we now use the size of the skipNodes map
as an  upper limit within the primary selection loop.
2017-08-22 00:51:43 -07:00
Olaoluwa Osuntokun
a8576eaa69
autopilot: fix bug in skip nodes test, use new instance for each run 2017-08-22 00:51:39 -07:00
Olaoluwa Osuntokun
804edb8f02
autopilot: ensure all access to pendingOpens is thread-safe
In this commit, we ensure that we grab the mutex for the pending open
channel state when we attempt to merge the pending state with the
committed state.
2017-08-22 00:51:33 -07:00
bryanvu
c87678e695 test: reposition context creation and extend TLS timeout
Fixes timeouts during integration tests on slower machines.
2017-08-19 16:42:33 -07:00
Alex
a7218e84ea lnd_test: reverse the order of teardown for lnd and btcd harnesses
This commit prevents the case where btcd stops before lnd is fully
started, thus making lnd_test hang on trying to stop lnd using
`StopDaemon`. The underlying issue is that while lnd is trying to
start the server and subscribe to block notifications from btcd,
btcd stops, and lnd continues to attempt to reconnect before it
ever starts the interrupt handler. This reversal avoids that issue
by making sure lnd is stopped before btcd.
2017-08-19 16:37:16 -07:00
Olaoluwa Osuntokun
65dede2584
peer: ensure chan sends to breachArbiter can't block indefinitely
This commit fixes a possible deadlock bug that may arise during
shutdown due to an unconditional send on a channel to the breach
arbiter. We do this on two occasions within the peer: when loading a
new contract to give it the live version, and also when closing a
channel to ensure that it no longer watches over it.

Previously it was possible for these sends to block indefinitely in the
scenario that the server was shutting down (which means the breach
arbiter) is. As a result, the channel would never be drained, meaning
the server couldn’t complete shutdown as the peer hadn’t exited yet.
2017-08-18 12:16:29 -07:00
Alex
f67ce4e6d7 main: fix TLS cert autogen and server configuration 2017-08-18 12:05:08 -07:00
Alex
5d971a8ea8 lncli: add support for macaroons 2017-08-17 19:20:41 -07:00
Alex
922b065de5 main: integrate macaroons into config, startup, and RPC server 2017-08-17 19:20:41 -07:00
Alex
662731e719 macaroons: add macaroons package and update glide 2017-08-17 19:20:41 -07:00
Olaoluwa Osuntokun
5ef077e5c8
routing: cap number of yen's algorithm iterations at 100
This commit makes a precautionary change in order to ensure that the
upper bound on the number of iteration’s within our version of Yen’s
algorithm is fixed.
2017-08-15 19:56:41 -07:00
Olaoluwa Osuntokun
09521b9c2a
autopilot: fix linter error 2017-08-15 18:26:59 -07:00
Olaoluwa Osuntokun
711b695a2f
autopilot: add tracking of pending channel state
This commit adds tracking of the pending channels state within the
autopilot.Agent. This fixes a class of bugs which was discovered during
the latest test net block storm wherein the Agent would attempt to
repeatedly attach to the same node due to rapid closure of other
channels.

In this commit we fix this issue by ensuring that we always factor in
the pending channel state when querying the heuristic w.r.t if we need
more channels, and if so to which nodes should be attached to.
2017-08-15 18:23:58 -07:00
Olaoluwa Osuntokun
8034780ca4
autopilot: fix chanID collision test flake by instead using atomic counter
This commit fixes a prior occasional test flake caused by the collision
of the randomly selected 64-bit integers. In order to get around this,
we now instead have a atomic monotonically increasing counter for each
channel ID used within the tests.
2017-08-15 17:56:24 -07:00
Olaoluwa Osuntokun
572eef2840
htlcswitch: add channel point prefix to HTLC examine logs 2017-08-15 17:55:06 -07:00
Olaoluwa Osuntokun
f458dc26ed
lnwallet: correct godoc comments on script util helper functions
The godoc comments for htlcSpendRevoke and htlcSpendSuccess were
incorrect.
2017-08-15 17:53:45 -07:00
Olaoluwa Osuntokun
c4e43dbaa2
server: avoid nil pointer deference within OutboundPeerConnected 2017-08-15 17:49:35 -07:00
sam
06ff0a0192 BOLT's -> BOLTs 2017-08-14 17:53:52 -07:00
Max Fang
b88438d708 lnrpc: Add descriptions and lncli mappings to rpc.proto 2017-08-14 17:53:19 -07:00
Max Fang
9cd1168ebe docs: State example gRPC assumptions, add TLS grpc instructions 2017-08-14 17:51:41 -07:00
Max Fang
96a5fdd3ec Remove characters from docker guide that break utf-8 encoding 2017-08-14 17:51:41 -07:00
Max Fang
ab97fa7287 docs: Javascript gRPC streaming examples & complete guide 2017-08-14 17:51:41 -07:00
Max Fang
34d270398f docs: Make Python gRPC docs suitable as an independent guide 2017-08-14 17:51:41 -07:00
Max Fang
9f8378f4cf readme+docs: Consolidate installation docs 2017-08-14 17:51:41 -07:00
Olaoluwa Osuntokun
06782ebdb3 Merge pull request #225 from halseth/channel-close-negotiation2
Add fee negotiation on channel cooperative shutdown.
2017-08-14 17:48:05 -07:00
Alex
58c6989e74 tests: fix several timeout issues 2017-08-14 17:02:31 -07:00
Johan T. Halseth
e8e87322dd
peer: add channel close fee negotiation
This commit adds the fee negotiation procedure performed
on channel shutdown. The current algorithm picks an ideal
a fee based on the FeeEstimator and commit weigth, then
accepts the remote's fee if it is at most 50%-200% away
from the ideal. The fee negotiation procedure is similar
both as sender and receiver of the initial shutdown
message, and this commit also make both sides use the
same code path for handling these messages.
2017-08-11 12:10:32 +02:00
Johan T. Halseth
b9516b7cdd
lnwallet: make CreateCloseProposal take absolute fee instead of fee rate 2017-08-11 12:09:39 +02:00
Olaoluwa Osuntokun
48be9261ef
autopilot: fix linter error 2017-08-10 22:07:22 -07:00
Olaoluwa Osuntokun
143e7bdf5f
test: ensure nodes spun up by test framework use fresh config files
This commit modifies the way the nodes spun up the by test framework
are created such that they don’t use the configuration parameters
storage in the normal lnd home directory. Otherwise, tests would pick
up the configuration of the user’s pre-existing lnd nodes.
2017-08-10 22:00:53 -07:00
Olaoluwa Osuntokun
c02710c8c9
test: add +build !rpctest to tests files in main package
This commit adds the +build !rpctest build flag to the test files in
the main package other than the RPC tests. With this, if the protest
build flag is set, then ONLY those tests will be run.
2017-08-10 21:59:23 -07:00
Olaoluwa Osuntokun
512a5c899b
rpc: only set balance params when force closing if output not dust
This commit fixes an existing bug that would cause a force closed
channel to stay pending forever. In this instance, if one force closes
a channel while they have a dust output, and restart before the channel
is fully closed, then it wouldn’t have been closed automatically
(within the database) by the autopilot agent.
2017-08-10 21:43:17 -07:00
Olaoluwa Osuntokun
ece1d09a9f
lnd: initialize an autopilot.Agent instance if set in the config file 2017-08-10 21:40:16 -07:00