Commit Graph

4380 Commits

Author SHA1 Message Date
Wilmer Paulino
13fb866574
chainntnfs: remove txindex requirement when registering notfications
Before this commit, we relied on the need of full nodes to enable the
transaction index. This allowed us to fetch historical details about
transactions in order to register and dispatch confirmation and spend
notifications.

This commit allows us to drop that requirement by providing a fallback
method to use when the transaction index is not enabled. This fallback
method relies on manually scanning blocks for the transactions
requested, starting from the earliest height the transactions could have
been included in, to the current height in the chain.
2018-04-17 14:59:51 -04:00
Olaoluwa Osuntokun
7f039980c1
lnd+cmd/lncli: allow users to disable logging sub-systems all together 2018-04-16 19:18:04 -07:00
Olaoluwa Osuntokun
09291d6aeb
contractcourt: ensure the closeObserver exits on quit 2018-04-16 17:28:48 -07:00
Olaoluwa Osuntokun
f23848cac0
Merge pull request #1093 from halseth/copy-htlc-rhash
[bugfix] Copy htlc rhash when returing ListChannelsResponse
2018-04-16 17:18:56 -07:00
Olaoluwa Osuntokun
87c1ca1a84
Merge pull request #1105 from halseth/chainntfs-btcd-hostorical-mempool-spends
Notify on confirmed spends during btcd rescans
2018-04-16 16:38:46 -07:00
Johan T. Halseth
53ec1c6fd2
chainntnfs test: Test historical dispatch for mempool and non-mempool clients
This commit extends the test to exercise a scanario that wasn't properly
covered, by registering for a confirmed spend notification for a
historical spend. We also extend the test to make sure it handles buried
spends properly.
2018-04-16 20:09:17 +02:00
Johan T. Halseth
5d6dd90d18
chainntnfs/btcdnotify: correctly notify on confirmed rescan spends
This commit fixes a recently introduced bug in the btcdnotifier, where
we would skip all spend clients waiting for a confirmed spend in
txUpdates. The regular case where a spend is included in a new block was
correctly handled in onBlockConnected, but the txUpdates queue is also
used for confirmed spends during rescans, which we would miss. This
commit fixes that by checking if the tx update is confirmed or
unconfirmed, and acts accordingly.
2018-04-16 20:09:08 +02:00
Johan T. Halseth
6573eed37b
lnd_test: wrap check for expected number of channels in WaitPredicate 2018-04-15 18:55:55 +02:00
Johan T. Halseth
4bd45b22eb
lnd_test: make assertActiveHtlcs correctly check the exact pay hashes 2018-04-15 11:36:20 +02:00
Johan T. Halseth
daeeca0bc3
rpcserver: make copy of htlc rhash before returning in listchannels
This commit fixes a bug where all the HTLC rhash slices in a
ListChannelsResponse would be tied to the loop variable, making them all
take the hash of the last HTLC in the list. This commit fixes it by
making a copy of the slice.
2018-04-15 11:36:20 +02:00
Olaoluwa Osuntokun
b0709b45f7
Merge pull request #1090 from halseth/servertest-build-flag
[trivial] server test: add !rpctest build flag
2018-04-13 20:43:49 -07:00
Olaoluwa Osuntokun
4bf86aab27
test: in testUpdateChannelPolicy wait for Alice to learn of all channels
In this commit, we fix an existing flake in the integration tests. If it
was the case that Alice didn't yet know of all the channels, then the
payment attempt below would fail at times, depending on other timing
factors in the test. We fix this flake by waiting for Alice to learn of
all channels before we proceed to the actual testing logic.
2018-04-13 15:35:59 -07:00
Olaoluwa Osuntokun
5f0d07e485
Merge pull request #1089 from halseth/resolvecontract-missing-return-on-exit
Add missing return on exit to resolveContract
2018-04-13 14:23:13 -07:00
Olaoluwa Osuntokun
cc08baec63
Merge pull request #1088 from Roasbeef/chan-close-fix
contractcourt: fix co-op chan close issue by not closing over loop iterator variable
2018-04-13 13:41:41 -07:00
Johan T. Halseth
e949b6a915
server test: add !rpctest build flag 2018-04-13 12:27:01 +02:00
Johan T. Halseth
44f0ec9263
lnd_test: increase timeout for mempool tx 2018-04-13 12:07:58 +02:00
Johan T. Halseth
c5169a79f5
contractcourt/channel_arbitrator: add missing return on resolver exit
This commit adds a missing return to the resolveContract method, that
will ensure the goroutine exits if the ChannelArbitrator shuts down.
This fixes a potential deadlock during the integration tests.

We also promote some of the logs to Debug from Trace.
2018-04-13 11:33:09 +02:00
Johan T. Halseth
25d56eda6f
lntest: timeout if process not exited in 1 minute 2018-04-13 11:33:08 +02:00
Olaoluwa Osuntokun
86ad6d318e
Merge pull request #889 from wpaulino/chainnotifier-updates
chainntnfs: add incremental update notifications within ChainNotifier
2018-04-12 19:21:26 -07:00
Olaoluwa Osuntokun
aaa8fa33b1
contractcourt: when creating resolveContract closure don't bind to loop variable
In this commit, we fix a long standing bug where at times a co-op
channel closure wouldn't be properly marked as fully closed in the
database. The culprit was a re-occurring code flaw we've seen many times
in the codebase: a closure variable that closes over a loop iterator
variable. Before this instance, I assumed that this could only pop up
when goroutines bind to the loop iterator within a  closure. However,
this instance is the exact same issue, but within a regular closure that
has _delayed_ execution. As the closure doesn't execute until long after
the loop has finished executing, it may still be holding onto the _last_
item the loop iterator variable was assigned to.

The fix for this issue is very simple: re-assign the channel point
before creating the closure. Without this fix, we would go to call
db.MarkChanFullyClosed on a channel that may not have yet actually be in
the pending close state, causing all executions to fail.

Fixes #1054.
Fixes #1056.
Fixes #1075.
2018-04-12 18:54:33 -07:00
Olaoluwa Osuntokun
f052f18312
test: extend closeChannelAndAssert to also check that channel is no longer pending close
In this commit, we extend the closeChannelAndAssert testing utility
function to ensure that the channel is no longer marked as "pending
close" in the database. With this change, we hop to catch a recently
reported issue wherein users report that a co-op close channel has been
fully confirmed, yet it still pops up in the `pendingchannels` command.
2018-04-12 18:54:32 -07:00
Francisco Calderon
f61a71b6fc docs/macaroons: add reference to invoice.macaroon 2018-04-12 17:25:52 -07:00
Andrew Fuller
26bf3fcb1c README: update Slack invite link 2018-04-12 17:22:52 -07:00
Olaoluwa Osuntokun
7a13378671
channeldb+contractcourt: add additional logging around co-op channel closes 2018-04-12 17:13:37 -07:00
Olaoluwa Osuntokun
f667e3b29f
Merge pull request #1079 from cfromknecht/chain-watcher-unlock
contractcourt/chain_watcher: release mutex on return
2018-04-11 16:16:24 -07:00
Conner Fromknecht
218293db4a
contractcourt/chain_watcher: release mutex on return 2018-04-11 14:50:05 -07:00
Olaoluwa Osuntokun
bc029b9cd4
contractcourt: properly log error if unable to update chan close state 2018-04-10 16:55:32 -07:00
mecampbellsoup
921f505b12 [.gitignore] Ignore *.iml files from IntelliJ 2018-04-10 09:27:44 -04:00
mecampbellsoup
bd398540c1 Add version field to GetInfo RPC endpoint
This is inspired by the Bitcoin RPC `getnetworkinfo` endpoint which also
includes version information:
https://bitcoin.org/en/developer-reference#getnetworkinfo
2018-04-10 09:27:44 -04:00
Olaoluwa Osuntokun
12cb35a6c9
Merge pull request #1067 from cfromknecht/fmgr-scope-fix
fundingmanager: fixes range-goroutine scoping bug
2018-04-09 20:49:50 -07:00
Jim Posen
4b2cb68fe6 discovery: Fix formatting issue in log line. 2018-04-09 20:49:23 -07:00
Olaoluwa Osuntokun
32ad632aa1
Merge pull request #956 from halseth/channel-newlocalforceclosesummary
[refactor] lnwallet/channel: add NewLocalForceCloseSummary
2018-04-09 20:47:53 -07:00
Olaoluwa Osuntokun
9d29c4f43d
server: only swap out the port for inbound connections
Note that the check is actually reversed to the quirk atm in the server
logic, where inbound and outbound are reversed.

Fixes #1063.
2018-04-09 19:55:01 -07:00
Conner Fromknecht
5c43e0ad02
fundingmanager: fixes range-goroutine scoping bug
This commit fixes an issue in funding manager startup,
where a goroutine reads from a range value. The method in
question could cause a channel to be announced at the
wrong time.

This may have been a cause for certain channels having
phantom HTLCs before they had even received the funding
locked message from the remote peer.

This is fixed simply by using the locally scoped
variable passed in as an argument to the goroutine.
2018-04-09 16:55:41 -07:00
Karlson Lee
16c304a4c1 docs/grpc/python remove witness_only 2018-04-09 13:01:39 -07:00
Olaoluwa Osuntokun
13945de806
Merge pull request #1041 from aakselrod/bitcoind-cn-ooo-fix
chainntnfs/bitcoindnotify: rescan blocks manually instead of rewinding
2018-04-06 20:32:24 -07:00
Alex
89e2ba41c9 chainntnfs/bitcoindnotify: rescan blocks manually instead of rewinding 2018-04-06 20:35:27 -06:00
Olaoluwa Osuntokun
5b5491338b
Merge pull request #1019 from Roasbeef/proper-link-constraints
htlcswitch: properly apply the fee constraints of the *outgoing* link when accepting HTLC's
2018-04-06 18:31:13 -07:00
Olaoluwa Osuntokun
31d2f4595f
Merge pull request #1035 from Roasbeef/bip-compliant-neutrino
build: update to point to BIP158+BIP157 compliant btcd+btcutil+neutrino
2018-04-06 18:11:15 -07:00
Olaoluwa Osuntokun
3b47a24a7e
build: update to point to BIP158+BIP157 compliant btcd+btcutil+neutrino 2018-04-06 16:29:30 -07:00
Olaoluwa Osuntokun
fb3c488d3c
build: update to version of btcd w/ mempool spend ntfns 2018-04-06 16:21:09 -07:00
Olaoluwa Osuntokun
1034bdf9e0
Merge pull request #1034 from halseth/funding-custom-csv-delay-bugfix
[bugfix] Custom remote_csv_delay and min_htlc_msat
2018-04-06 15:41:04 -07:00
vegardengen
5eed171187 config: make log rotation configurable 2018-04-06 15:11:42 -07:00
Olaoluwa Osuntokun
a6ffe999c6
routing: prune vertex, not ege after repeated FeeInsufficientErrors
In this commit, we modify the way we handle FeeInsufficientErrors to
more aggressively route around nodes that repeatedly return the same
error to us. This will ensure we skip older nodes on the network which
are running a buggier older version of lnd. Eventually most nodes will
upgrade to this new version, making this change less needed.

We also update the existing test to properly use a multi-hop route to
ensure that we route around the offending node.
2018-04-06 14:52:02 -07:00
Olaoluwa Osuntokun
aa7f83d72e
lnwire: remove pointer receiver from ToUint64 for ShortChannelID 2018-04-06 14:52:02 -07:00
Olaoluwa Osuntokun
3fa2e08665
test: update testUpdateChannelPolicy to ensure Bob's link uses the proper policies
In this commit, we update the testUpdateChannelPolicy to exercise the
recent set of changes within the switch. If one applies this test to a
fresh branch (without those new changes) it should fail. This is due to
the fact that before, Bob would attempt to apply the constraints of the
incoming link (which we updated) instead of the outgoing link. With the
recent set of changes, the test now properly passes.
2018-04-06 14:52:01 -07:00
Olaoluwa Osuntokun
ffabb17ce6
peer: use new fetchLastChanUpdate method to populate the ChannelLinkConfig 2018-04-06 14:52:01 -07:00
Olaoluwa Osuntokun
8b520377bb
htlcswitch: fix TestUpdateForwardingPolicy
In this commit, we fix the TestUpdateForwardingPolicy test case after
the recent modification in the way we handling validating constraints
within the link. After the recent set of changes, Bob will properly use
his outgoing link to validate the set of fee related constraints rather
than the incoming link. As a result, we need to modify the second
channel link, not the first for the test to still be applicable.
2018-04-06 14:52:01 -07:00
Olaoluwa Osuntokun
ec8e3b626d
htlcswitch: update unit tests to account for recent API changes 2018-04-06 14:52:00 -07:00
Olaoluwa Osuntokun
0a47b2c4ad
htlcswitch: remove linkControl in favor of a mutex guarding all channel indexes
In this commit, we simplify the switch's code a bit. Rather than having
a set of channels we use to mutate or query for the set of current
links, we'll instead now just use a mutex to guard a set of link
indexes. This serves to simplify the ode, and also make it such that we
don't need to block forwarding in order to add/remove a link.
2018-04-06 14:52:00 -07:00