Commit Graph

7736 Commits

Author SHA1 Message Date
fcf74debe6 lnwallet+funding: rename Capacity and FundingAmt
Instead use LocalFundingAmt and RemoteFundingAmt to make it clear who is
contributing funds.
2019-07-18 00:33:14 +02:00
e716251805 server+funding: remove unused remoteFundingAmt 2019-07-18 00:33:14 +02:00
2f5c1a69fb lnwallet test: add TestCoinSelect 2019-07-18 00:33:14 +02:00
78da62c6f7 fundingmanager tests: run tests in parallel 2019-07-18 00:33:14 +02:00
452ee6aad4 fundingmanager+server: define MaxPendingChans. RejectPush in funding config
This commit makes the funding manager access the MaxPendingChannels and
RejectPush values from the fundingConfig instead of the global config
struct.

Done to avoid sharing state between tests.
2019-07-18 00:33:14 +02:00
0d3ef43c92 lnd: log error if any throughout initialization
In this commit, we establish a new pattern to always log errors before
returning them to the higher level caller, which then prints the error
to stdout/stderr. Errors returned are usually lowercase, but we decide
not to apply this rule here as these errors should not be chained
forward.
2019-07-17 14:24:21 -07:00
98274f63dc Merge pull request #3307 from Roasbeef/better-aezeed-error
aezeed: publicly export the `word` field  in `ErrUnknownMnenomicWord`
2019-07-16 20:15:48 -07:00
d5122b7f04 aezeed: publicly export the word field in ErrUnknownMnenomicWord
In this commit, we publicly export the `word` field as it makes it
easier to programmatically interact with the package when attempting to
re-derive proper `cipherseed` instances. We also add a new `Index` field
as well to provide additional context for programmatic manipulating of
seeds.
2019-07-16 19:31:35 -07:00
92e14af72a Merge pull request #3298 from joostjager/globalize-mc
routing: globalize mc
2019-07-16 17:39:36 -07:00
3faece15be Merge pull request #3314 from cfromknecht/remove-initial-graph-sync
peer: don't reply to requests for `initial_graph_sync`
2019-07-16 16:45:38 -07:00
97d8be7f6a rpcserver: query and set num_zombie_chans in NetworkInfo resp 2019-07-16 16:32:27 -07:00
0223039fb4 channeldb/graph: add NumZombies method and tests 2019-07-16 16:32:27 -07:00
4b70d6b987 lnrpc: add num_zombie_chans to NetworkInfo response 2019-07-16 16:32:27 -07:00
9781ea0082 router: Optimize pruneZombieChannels.
The current approach iterates all channels in the graph in order to
filter those in need. This approach is time consuming, several seconds
on my mobile device for ~40,000 channels, while during this time the
db is locked in a transaction.

The proposed change is to use an existing functionality that utilize the
fact that channel update are saved indexed by date. This method enables
us to go over only a small subset of the channels, only those that
were updated before the "channel expiry" time and further filter
them for our need.
The same graph that took several seconds to prune was pruned, after
the change, in several milliseconds.

In addition for testing purposes I added Initiator field to the
testChannel structure to reflect the channeldEdgePolicy direction.
2019-07-16 17:48:07 +03:00
7300f33fe2 graph: implement index for disabled channels.
This commit adds an index bucket, disabledEdgePolicyBucket, for those
ChannelEdgePolicy with disabled bit on.
The main purpose is to be able to iterate over these fast when prune is
needed without the need for iterating the whole graph.

The entry points for accessing this index are:
1. When updating ChannelEdgePolicy - insert an entry.
2. When deleting ChannelEdge - delete the associated entries.
3. When querying for disabled channels - implemented DisabledChannelIDs
function
2019-07-16 17:48:07 +03:00
a7152efca4 Merge pull request #3313 from wpaulino/neutrino-cleanup-panic
lnd: prevent panic on nil neutrino cleanup
2019-07-15 19:41:29 -07:00
a4097c113a discovery/gossiper: remove unused SynchronizeNode method 2019-07-15 14:11:18 -07:00
9eda94a40e peer: don't reply if peer's request initial_graph_sync
We stopped requesting this from other nodes as it is very expensive as
the graph continues to grow. In this commit we will also stop
responding, as nodes are recommended to begin using the `gossip_queries`
and upcoming `extended_gossip_queries` to reconcile missing graph data.
2019-07-15 14:09:42 -07:00
62d716d3c3 chainregistry: properly close neutrino database upon errors 2019-07-15 13:42:01 -07:00
e147445c08 lnd: prevent panic on nil neutrino cleanup
A cleanup closure is not included when an error is returned, causing the
defer to execute and triggering the following panic:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x105da38]

goroutine 1 [running]:
github.com/lightningnetwork/lnd.Main(0x2083e40, 0xc0004f6db0)
	/home/user/lnd/lnd.go:208 +0x2bfa
main.main()
	/home/user/lnd/cmd/lnd/main.go:14 +0x26
2019-07-15 13:32:37 -07:00
8055bcf2e0 routing: report failures to mission control directly
As there is no more state kept in the payment session, failure reporting
can go straight to mission control.
2019-07-13 22:38:25 +02:00
dc13da5abb routing: move second chance logic into mission control
If nodes return a channel policy related failure, they may get a second
chance. Our graph may not be up to date. Previously this logic was
contained in the payment session.

This commit moves that into global mission control and thereby removes
the last mission control state that was kept on the payment level.

Because mission control is not aware of the relation between payment
attempts and payments, the second chance logic is no longer based
tracking second chances given per payment.

Instead a time based approach is used. If a node reports a policy
failure that prevents forwarding to its peer, it will get a second
chance. But it will get it only if the previous second chance was
long enough ago.

Also those second chances are no longer dependent on whether an
associated channel update is valid. It will get the second chance
regardless, to prevent creating a dependency between mission control and
the graph. This would interfer with (future) replay of history, because
the graph may not be the same anymore at that point.
2019-07-13 22:38:23 +02:00
d31efddf1b routing: move generateBandwidthHints 2019-07-13 22:38:21 +02:00
37e2751695 routing+routerrpc: isolate payment session source from mission control 2019-07-13 22:38:19 +02:00
cf3dd3fb94 routing/test: create mission control test context 2019-07-13 22:38:17 +02:00
616750184e Merge pull request #2926 from Crypt-iQ/visited_nodes_0410
routing: tracking visited nodes in findPath
2019-07-12 17:29:11 -07:00
0c8ff3021c Merge pull request #2682 from valentinewallace/fix-subscribe-chans-flake
lnd_test: fix channel event subscription test flake.
2019-07-12 16:08:18 -07:00
21c685d530 lnd_test: fix channel event subscription test flake.
This flake was caused by the rpcserver receiving a CloseChannel request
before Alice's channel event subscription request, causing Alice to miss one
notification. As a result, we move Alice's subscription to the beginning of the
test.

Additionally, we add a check to ensure the opening notifications are
received in the right order.
2019-07-12 14:47:28 -07:00
9d213948ba docs/grpc: add C# docs 2019-07-12 13:23:31 -07:00
f069276970 Merge pull request #3306 from ottosuess/patch-4
invoicesrpc: fix route hint off-by-one-error
2019-07-12 12:28:15 +02:00
e593c5e16f Merge pull request #3284 from wpaulino/bitcoind-zmq-unnecessary-timeouts
build: update dependencies to prevent unnecessary bitcoind ZMQ timeouts
2019-07-12 12:26:55 +02:00
nsa
7e6a34532e routing: add index map to distanceHeap
This commit adds the pubkeyIndices map to the distanceHeap to avoid
duplicate entries on the heap. This happened in the earlier iteration
of the findPath algorithm and would cause the driving loop to
evaluate already evaluated entries when there was no need.
2019-07-12 06:08:01 -04:00
nsa
61a1ab08fb routing+channeldb: findPath uses Vertex instead of LightningNode
This commit modifies the nodeWithDist struct to use a route.Vertex
instead of a *channeldb.LightningNode. This change, coupled with
the new ForEachNodeChannel function, allows the findPath Djikstra's
algorithm to cut down on database lookups since we no longer need
to call the FetchOtherNode function.
2019-07-12 06:08:01 -04:00
4faed1deff build: update btcwallet and zmq dependencies
* We address an issue where we would unnecessarily time out bitcoind ZMQ
  connections if there are no messages to be read. This would cause
  connections to be torn down, which would then trigger the reconnection
  logic and prevent us from detecting this issue.

* A new sanity check within the wallet is done to prevent adding
  unconfirmed transactions that the wallet has already recognized as
  confirmed.
2019-07-12 02:40:16 -07:00
c843835a05 invoicesrpc: fix route hint off-by-one-error
right now it is possible to add 21 route hints which results in an error.
2019-07-12 08:51:30 +02:00
0193034f4f Merge pull request #2957 from halseth/taketa-goroutine-snapshot
[lnd test] write goroutine snapshot on integration test failure
2019-07-11 16:11:51 -07:00
5c11dd44d7 Merge pull request #3297 from orbitalturtle/makefile-case-clarification
MAKEFILE: Clarify what the testcase argument is
2019-07-11 14:40:29 -07:00
a4f4ff0f83 Merge pull request #3188 from joostjager/error-source-idx
htlcswitch+routing+routerrpc: error source as index and expose decrypt failure
2019-07-11 13:27:14 -07:00
2e0af923f3 Merge pull request #2366 from ccdle12/routing-policy-timestamps
lnrpc+rpcserver: Adding timestamps to RoutingPolicy
2019-07-11 12:10:03 -07:00
2726f50d7c htlcswitch: do not consider unknown failures an error 2019-07-11 19:49:49 +02:00
c6f9517e48 lnwire+htlcswitch: only use references for failure messages
Methods on failure message types used to be defined on value receivers.
This allowed assignment of a failure message to ForwardingError both as
a value and as a pointer. This is error-prone, especially when using a
type switch.

In this commit the failure message methods are changed so that they
target pointer receivers.

Two instances where a value was assigned instead of a reference are
fixed.
2019-07-11 19:49:47 +02:00
418fe364de htlcswitch: use distinct error for unreadable failures 2019-07-11 19:49:45 +02:00
0820b07c19 make: add -goroutinedump, rm pprof*.log to itest 2019-07-11 14:47:02 +02:00
8b64b14627 gitignore: add pprof files to gitignore 2019-07-11 14:44:50 +02:00
195a868455 lntest: add flag -goroutinedump 2019-07-11 14:44:44 +02:00
8d5430dae3 lnd_test: add lndHarness to harnessTest, dump goroutines on Fatalf
Co-authored-by: taketa <853211b@gmail.com>
2019-07-11 14:41:41 +02:00
314ba7db03 lntest/harness: add method SaveProfilesPages
SaveProfilesPages will write the active goroutines to files
pprof-n-*.log.

Co-authored-by: taketa <853211b@gmail.com>
2019-07-11 14:41:40 +02:00
6028722d71 lntest/node: make ProfilePort part of node config 2019-07-11 14:36:59 +02:00
0cdae56d28 htlcswitch+routing: make error decryption mockable 2019-07-11 10:37:28 +02:00
2b47632b26 htlcswitch+routing+routerrpc: return error source as index 2019-07-11 10:37:26 +02:00