Commit Graph

8528 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
fc658dbf60
docs: further clarify --txindex usage for full nodes 2018-06-18 14:01:25 +01:00
Dan Bolser
b5d8cde6fc README: update README to indicate tx index is no longer required for full node backends 2018-06-18 05:58:24 -07:00
Olaoluwa Osuntokun
7c2307984d
Merge pull request #1380 from cfromknecht/nursery-rebroadcast
utxonursery: rebroadcast finalized kinder txns on startup
2018-06-15 16:49:58 -07:00
Olaoluwa Osuntokun
2f6ff2666c
Merge pull request #1296 from parakeety/add-tdt
htlcswitch: add basic table driven tests for ExpectedFee
2018-06-15 16:36:40 -07:00
Olaoluwa Osuntokun
aeca4d6def
Merge pull request #1390 from Roasbeef/sorted-closed-channels
rpc: sort closed channels in order of ascending height
2018-06-15 16:02:30 -07:00
Johan T. Halseth
3bdc968f39
breacharbiter: wait on spend events instead of timeout
This commit handles a racy condition within the breacharbiter's justice
tx procedure. For backends that have no mempool we would check if an
HTLC output was spent and then try broadcasting the justice tx, but this
would fail since we wouldn't detect the spend before it was in a block.
The result was that we would continuously attempt to broadcast the
transaction, effectively ending up in an endless (until the second-level
tx actually comfirmed) loop.

Instead we now register for spend notifications in case broadcasting the
transaction fails, and then wait for any of the notifications to be
sent before trying again.

This is a necessary step to be able to make lnd work well only with
confimed transactions, and was a better solution than introducing
timeouts within the broadcast loop (which complicates integration
tests).
2018-06-15 12:11:13 +02:00
Johan T. Halseth
e0560741b4
breacharbiter test: add TestBreachSecondLevelTransfer 2018-06-15 12:11:13 +02:00
Johan T. Halseth
60d9ae02c7
mock: protect mockSpendNotifier map by mutex 2018-06-15 12:11:13 +02:00
Johan T. Halseth
9aa55b164e
breacharbiter test: extract common init logic 2018-06-15 12:11:13 +02:00
yohei okada
7b37cbd2d9
htlcswitch: add basic table driven tests for ExpectedFee 2018-06-15 17:29:02 +09:00
Olaoluwa Osuntokun
d82ef41245
rpc: sort closed channels in order of ascending height 2018-06-14 17:14:39 -07:00
Oliver Gugger
8d6b49384a
config: add unix socket example to sample configuration 2018-06-14 08:19:10 +02:00
Oliver Gugger
9f0e39f881
lncli: add support for unix sockets 2018-06-14 08:19:10 +02:00
Oliver Gugger
c1b1dd96ef
lncfg: move configuration helper methods to new package 2018-06-14 08:19:09 +02:00
Oliver Gugger
460fa25871
config+lnd+server: add unix socket support 2018-06-14 08:19:09 +02:00
Olaoluwa Osuntokun
b5a228808b
Merge pull request #1375 from wpaulino/gossiper-cancel-block-epochs
discovery/gossiper: hold ref to block epoch stream and cancel when stopped
2018-06-13 22:16:52 -07:00
Wilmer Paulino
90a50bd893
peer: remove no longer needed block epoch 2018-06-13 19:23:44 -07:00
Wilmer Paulino
9ecfdb3c32
discovery/gossiper: hold ref to block epoch stream and cancel when stopped 2018-06-13 19:20:53 -07:00
Olaoluwa Osuntokun
6830024faf
Merge pull request #1367 from halseth/waitpredicate-interval
lntest/harness: add pollIntervall to WaitPredicate
2018-06-13 19:17:30 -07:00
Olaoluwa Osuntokun
1e8a5104ba
Merge pull request #1338 from Roasbeef/packet-queue-exit
htlcswitch: ensure the packet queue exits on stop
2018-06-13 19:17:12 -07:00
Olaoluwa Osuntokun
39f2739d84
Merge pull request #1229 from wpaulino/randomize-link-fee-updates
htlcswitch: randomize link fee updates
2018-06-13 19:11:48 -07:00
Olaoluwa Osuntokun
4a0d7b0244
Merge pull request #1374 from wpaulino/zero-amount-invoice-error
rpcserver: return err when paying 0 amt invoice and amt is not specified
2018-06-13 18:56:04 -07:00
Wilmer Paulino
8198466972
multi: move block epochs dependency from links to switch
In this commit, we move the block height dependency from the links in
the switch to the switch itself. This is possible due to a recent change
on the links no longer depending on the block height to update their
commitment fees.

We'll now only have the switch be alerted of new blocks coming in and
links will retrieve the height from it atomically.
2018-06-13 17:41:21 -07:00
Wilmer Paulino
4cc60493d2
peer+htlcswitch: randomize link commitment fee updates
In this commit, we modify the behavior of links updating their
commitment fees. Rather than attempting to update the commitment fee for
each link every time a new block comes in, we'll use a timer with a
random interval between 10 and 60 minutes for each link to determine
when to update their corresponding commitment fee. This prevents us from
oscillating the fee rate for our various commitment transactions.
2018-06-13 17:41:01 -07:00
Olaoluwa Osuntokun
c1a1b3ba3d
Merge pull request #1274 from joostjager/closechannels-squashed
rpc+lnrpc: add new closechannels cli+rpc command
2018-06-13 17:35:35 -07:00
Olaoluwa Osuntokun
dddbfa7efe
Merge pull request #1205 from wpaulino/initial-peer-bootstrap
server: improve initial peer bootstrapping
2018-06-13 16:51:41 -07:00