Commit Graph

4404 Commits

Author SHA1 Message Date
Conner Fromknecht
0ae6dec4f3
signal/signal: creates package for monitoring of OS signals 2018-06-28 16:16:58 -07:00
Olaoluwa Osuntokun
8ab464b4d1
Merge pull request #1456 from wpaulino/tor-post-lncfg
lncfg+config: parse and resolve onion addresses
2018-06-28 11:23:16 -07:00
Wilmer Paulino
bbeb8b2ddd
lncfg+config: use address string in IsLoopback 2018-06-27 19:03:30 -07:00
Olaoluwa Osuntokun
17399994e4
config+server: update usage of lncfg methods to pass in resolver
In this commit, we update all the lncfg methods used to properly pass in
a new resolver. This is required in order to ensure that we don't leak
our DNS queries if Tor mode is active.
2018-06-27 18:10:34 -07:00
Olaoluwa Osuntokun
37f56ce976
lncfg: add tor addresses to test cases 2018-06-27 18:10:32 -07:00
Olaoluwa Osuntokun
197b920cac
lncfg: update test cases to map port -> localhost:port 2018-06-27 18:10:31 -07:00
Olaoluwa Osuntokun
f5f68858de
lncfg: update verifyPort to map a plain port to localhost:port 2018-06-27 18:10:30 -07:00
Olaoluwa Osuntokun
5d66635aee
lncfg: update ParseAddressString to be able to parse tor addrs 2018-06-27 18:10:29 -07:00
Olaoluwa Osuntokun
c03f731643
server: properly use the set of normalized external ips 2018-06-27 16:43:38 -07:00
Olaoluwa Osuntokun
c344a3a642
Merge pull request #1453 from cfromknecht/decayed-log-flake
htlcswitch/decayedlog_test: fix bug in gc unit test
2018-06-27 16:37:08 -07:00
Conner Fromknecht
e85fa1af96
htlcswitch/decayedlog_test: fix bug in gc unit test
This commit fixes a bug in the
TestDecayedLogPersistentGarbageCollector unit test.
The test generates a second hash prefix, which is never
added to the log, and used to query for the final
existence check. This commit reverts the behavior so
that the same hash prefix is used throughout the test.
2018-06-27 14:40:28 -07:00
Olaoluwa Osuntokun
ec7cfc6906
Merge pull request #1447 from Roasbeef/forwarding-timelock-fix
routing+htlcswitch: finalize switch of CLTV delta directionality in path finding and link forwarding
2018-06-26 19:47:46 -07:00
Olaoluwa Osuntokun
81e647a520
Merge pull request #1449 from cfromknecht/wait-for-link-shutdown
Wait for link shutdown
2018-06-26 19:46:28 -07:00
parth
8c5543d701 aezeed/errors: add missing space in error message 2018-06-26 19:20:39 -07:00
Conner Fromknecht
66c4240234
htlcswitch/link: add WaitForShutdown method for testing 2018-06-26 18:28:54 -07:00
Conner Fromknecht
23f2d93402
htlcswitch/link_test: wait for link shutdown after removal 2018-06-26 18:28:53 -07:00
Olaoluwa Osuntokun
05d1d4e845
Merge pull request #1262 from guggero/unix-sockets
rpc: add support for unix sockets
2018-06-26 18:17:27 -07:00
Olaoluwa Osuntokun
b44ce7b366
Merge pull request #1312 from halseth/breacharbiter-wait-for-spend
breacharbiter: wait on spend events instead of timeout
2018-06-26 17:50:47 -07:00
Olaoluwa Osuntokun
6a6c29cd00
routing: fix incorrect expiry values in spec_example.json
In this commit, we fix the incorrect expiry values in the
spec_example.json test file. Many of the time locks were incorrect which
allowed bugs within the path finding logic related to CLTV deltas to go
un-detected.
2018-06-26 17:29:42 -07:00
Olaoluwa Osuntokun
6c986864ff
routing: fix bug in newRoute, use time lock delta of prior hop, not current
In this commit, we fix an existing bug in the newRoute method. Before
this commit we would use the time lock delta of the current hop to
compute the outgoing time lock for the current hop. This is incorrect as
the time lock delta of the _outgoing_ hop should be used, as this is
what we're paying for "transit" on. This is a bug left over from when we
switched the meaning of the CLTV delta on the ChannelUpdate message
sometime last year.

The fix is simple: use the CLTV delta of the prior (later in the route)
hop.
2018-06-26 17:29:42 -07:00
Olaoluwa Osuntokun
bdecc5bea9
htlcswitch: update forwarding policy verification to use new time lock info 2018-06-26 17:29:42 -07:00
Olaoluwa Osuntokun
7b4c150983
htlcswitch: add new incoming+outgoing timeout fields to htlcPacket 2018-06-26 17:29:41 -07:00
Olaoluwa Osuntokun
2bb5931bb7
htlcswitch: move timelock policy verification logic to HtlcSatifiesPolicy
In this commit, we extract the time lock policy verification logic from
the processRemoteAdds method to the HtlcSatifiesPolicy method. With this
change, we fix a lingering bug within the link: we'll no longer verify
time lock polices within the incoming link, instead we'll verify it at
forwarding time like we should. This is a bug left over from the switch
of what the CLTV delta denotes in the channel update message we made
within the spec sometime last year.
2018-06-26 17:29:41 -07:00
Olaoluwa Osuntokun
74ec9147b1
htlcswitch: extend the HtlcSatifiesPolicy to also accept timelock/height info
In this commit, we extend the existing HtlcSatifiesPolicy method to also
accept timelock and height information. This is required as an upcoming
commit will fix an existing bug in the forwarding logic wherein we use
the time lock policies of the incoming node rather than that of the
outgoing node.
2018-06-26 17:29:40 -07:00
Olaoluwa Osuntokun
6e051a80ff
htlcswitch: fix bug in generateHops, use CLTV delta of prior hop to compute payload
In this commit, we fix a bug in the generateHops helper function. Before
this commit, it erroneously used the CLTV delta of the current hop,
rather than that of the prior hop when computing the payload. This was
incorrect, as when computing the timelock for the incoming hop, we need
to factor in the CTLV delta of the outgoing lock, not the incoming lock.
2018-06-26 17:29:40 -07:00
Olaoluwa Osuntokun
4eb07e8288
htlcswitch: add new TestForwardingAsymmetricTimeLockPolicies test
In this commit, we add a new test to the switch:
TestForwardingAsymmetricTimeLockPolicies. This test ensures that a link
has two channels, one of which has a greater CLTV delta than the latter,
that a payment will successfully be routed across the channels. Atm, the
test fails (including the fix to hop payload generation included in the
next commit).

Atm, due to the way that we check forwarding policies, we'll reject this
payment as we're attempting to enforce the policy of the incoming link
(cltv delta of 7), instead of that of the outgoing link (cltv delta of
6). As a result, atm, the incoming link checks if (incoming_timeout -
delta < outgoing_timeout). For the values in the test case: 112 - 7 <
106 -> 105 < 106, this check fails. The payload is proper, but the check
itself should be applied at the outgoing hop.
2018-06-26 17:29:39 -07:00
Yaacov Akiba Slama
17223c1215 peer: add write timeout within writeMessage
In this commit, we add a timeout within the writeMessage method when we go to write to the socket. We do this as otherwise, if the other peer is blocked for some reason, we'll never actually unblock ourselves, which may cause issues in other sub-systems waiting on this write call. For now, we use a value of 10 seconds, and will adjust in the future if we deem this time period too short.
2018-06-26 17:27:22 -07:00
Oliver Gugger
c943f02c32
Merge branch 'master' into unix-sockets 2018-06-26 09:35:55 +02:00
Olaoluwa Osuntokun
b8fecfca71
Merge pull request #1442 from Roasbeef/async-link-stop
htlcswitch: in removeLink use new goroutine to stop existing link
2018-06-26 04:14:57 +02:00
Olaoluwa Osuntokun
1219e14955
Merge pull request #1399 from Roasbeef/zlib-decoding
lnwire: implement cautious zlib decoding for channel range queries
2018-06-26 04:13:54 +02:00
Olaoluwa Osuntokun
8ddb2bdc57
Merge pull request #1443 from brndnmtthws/add-profile-docs
docs: Add starter doc on debugging lnd.
2018-06-26 04:13:26 +02:00
Olaoluwa Osuntokun
23b1678266
lnwire: ensure zlib short chan id's are sorted 2018-06-25 16:16:37 -07:00
Olaoluwa Osuntokun
940b95aad7
lnwire: update testing.Quick tests to alternate between encoding types 2018-06-25 16:16:36 -07:00
Olaoluwa Osuntokun
5caf3d7310
lnwire: add new package level mutex to limit # of concurrent zlib decodings
In this commit, we add a new package level mutex. Each time we decode a
new set of chan IDs w/ zlib, we also grab this mutex. The purpose here
is to ensure that we only EVER allocate the maxZlibBufSize globally
across all peers. Otherwise, it may be possible for us to allocate up to
64 MB for _each_ peer, exposing an easy OOM attack vector.
2018-06-25 16:16:36 -07:00
Olaoluwa Osuntokun
a0e2f8dbd1 lnwire: implement zlib encode/decode for channel range queries
In this commit, we implement zlib encoding and decoding for the channel
range queries. Notably, we utilize an io.LimitedReader to ensure that we
can enforce a hard cap on the total number of bytes we'll ever allocate
in a decoding attempt.
2018-06-25 16:16:13 -07:00
Olaoluwa Osuntokun
19a0eab804
htlcswitch: in removeLink use new goroutine to stop existing link
In this commit, we modify the removeLink method to be more asynchronous.
Before this commit, we would attempt to block until the peer exits.
However, it may be the case that at times time, then target link is
attempting to forward a batch of packets to the switch (forwardBatch).
Atm, this method doesn't pass in an external context/quit, so we can't
cancel this message/request. As a result, we'll now ensure that
`removeLink` doesn't block, so we can resume the switch's main loop as
soon as possible.
2018-06-25 16:04:24 -07:00
Olaoluwa Osuntokun
c1c4b84757
Merge pull request #1372 from wpaulino/peer-log-unknown-channel
peer: prevent processing close msg if channel is not found
2018-06-26 00:54:58 +02:00
Brenden Matthews
c703418d1a
docs: Add starter doc on debugging lnd. 2018-06-25 16:27:58 -04:00
Wilmer Paulino
b1ba83bf2b
peer: prevent processing close msg if channel is not found 2018-06-25 13:13:12 -07:00
Olaoluwa Osuntokun
18f17ad49b
Merge pull request #1419 from cfromknecht/update-channel-packager-sid
Update channel packager sid
2018-06-21 13:49:00 +01:00
Olaoluwa Osuntokun
ce164a5233
Merge pull request #1418 from halseth/channel-stop
[bugfix] Channel stop bugfixes
2018-06-21 13:45:00 +01:00
Olaoluwa Osuntokun
70217422b5
Merge pull request #1417 from halseth/chanarb-stop
Properly stop ChannelArbitrators/blockEpocs
2018-06-21 13:42:20 +01:00
Johan T. Halseth
d787e74125
contractcourt/channel_arbitrator: stop block epoch on channel attendant exit 2018-06-21 11:13:46 +01:00
Johan T. Halseth
1c43a0cb36
contractcourt/chain_arbitrator: delete watcher from activeWatchers 2018-06-21 11:13:46 +01:00
Conner Fromknecht
56e5eed037
channeldb/channel: update short chan id for fwd packager 2018-06-19 13:48:08 +01:00
Conner Fromknecht
639c9875b2
channeldb/channel_test: test packager source updated 2018-06-19 13:48:08 +01:00
Johan T. Halseth
b56d922ce2
fundingmanager: properly stop channel on error 2018-06-19 12:48:38 +01:00
Johan T. Halseth
55c8741e42
peer: don't stop nil channel 2018-06-19 12:48:11 +01:00
Johan T. Halseth
327420d854
contractcourt/channel_arbitrator: Cancel block epoch in case of error in Start() 2018-06-19 12:20:30 +01:00
Oliver Gugger
4d521da1a3
Merge branch 'master' into unix-sockets 2018-06-19 11:27:24 +02:00