Commit Graph
100 Commits
Author SHA1 Message Date
Johan T. Halseth c0141a7bc1 Merge pull request #2937 from cfromknecht/moar-darwin-woes
lnd_test: bump timeout for darwin builds
2019-04-12 15:31:42 +02:00
Johan T. Halseth 0310d8f2b4 rpcserver: demote newaddress log to debug, log addr type 2019-04-10 09:08:36 +02:00
Johan T. Halseth 2782baf793 Merge pull request #2910 from halseth/neutrino-chainservice-stoporder
chainregistry: stop Neutrino before closing DB
2019-04-09 09:49:32 +02:00
Johan T. Halseth 9cc0ea93b2 chainregistry: stop Neutrino before closing DB
To avoid the ChainService still attempting to access the database when
it gets closed, re-order the stop order such that the Chainservice gets
stopped before closing the DB.
2019-04-08 12:48:51 +02:00
Johan T. Halseth 9e67f25957 chainregistry: only stop ChainService after successful start 2019-04-08 12:48:42 +02:00
Johan T. Halseth f1677e7199 lnrpc/routerrpc: make fmt on router backend test 2019-04-05 17:25:49 +02:00
Johan T. Halseth 38e4f03cbd Merge pull request #2870 from halseth/stop-chansubswapper
[trivial] server: stop chansubswapper on shutdown instead of start
2019-04-02 10:58:10 +02:00
Johan T. Halseth 96f4cd1df9 server: stop chansubswapper on shutdown instead of start 2019-04-02 09:58:13 +02:00
Johan T. Halseth 8087ea4c4c Merge pull request #2775 from wpaulino/reliable-sender-chan-update
discovery: check if stale within isMsgStale for ChannelUpdate messages
2019-04-01 12:08:33 +02:00
Johan T. Halseth ec70965c8a Merge pull request #2824 from wpaulino/chanid-openchannel
rpcserver: retrieve Channel ChanId from OpenChannel record
2019-03-27 15:29:46 +01:00
Johan T. Halseth 59e3390f6c Merge pull request #2750 from cryptagoras/patch-1
htlcswitch/switch: log target node on insufficient cap error
2019-03-27 15:10:08 +01:00
Johan T. Halseth 9d8e67d81e autopilot/prefattach: count small channels negatively
Decrease scores of nodes having a large number of small channels.
2019-03-27 15:06:30 +01:00
Johan T. Halseth d6d66e631a rpcserver: calculate and populate medianChanSizeSat in NetworkInfo 2019-03-27 15:06:30 +01:00
Johan T. Halseth f96dbd2377 lnrpc: add median_channel_size to NetworkInfo 2019-03-27 15:06:30 +01:00
Johan T. Halseth 6860ad9ac6 autopilot: add Median method 2019-03-27 15:06:30 +01:00
Johan T. Halseth 4d8100cc9a Merge pull request #2640 from joostjager/cltv-limit
routing: add cltv limit
2019-03-27 10:05:02 +01:00
Johan T. Halseth 6aae6fda93 lncli/autopilot: add -ignorelocal state flag to query 2019-03-18 14:58:19 +01:00
Johan T. Halseth d4813422c9 autopilot+autopilotrpc: ignore local channels if ignore_local_state set 2019-03-18 14:43:40 +01:00
Johan T. Halseth c7ab6f3603 lnrpc/autopilotrpc: add ignore_local_state flag 2019-03-18 14:42:58 +01:00
Johan T. Halseth dd072304b0 autopilot: move queryHeuristic out of agent
This commit moves the logic querying the available heuristics out of the
autopilot agent and into the autopilot manager. This lets us query the
heuristic without the autopilot agent being active.

If called without the agent being active, the current set of channels
will be considered by the heuristics. If the agent is active also the
pending channels will be considered.
2019-03-18 13:32:18 +01:00
Johan T. Halseth 54f1f32e71 lnwallet/interface_test: add testCreateSimpleTx 2019-03-15 23:47:15 +01:00
Johan T. Halseth 306c0c8aab lnwallet: return ErrNoOutputs in case no outputs are sent to 2019-03-15 23:47:15 +01:00
Johan T. Halseth a5becc2063 lncli: add estimatefee command 2019-03-15 23:47:15 +01:00
Johan T. Halseth 1e2af38f5a lnrpc+rpcserver: define and implement EstimateFee RPC 2019-03-15 23:47:13 +01:00
Johan T. Halseth bb092bc61e lnwallet/interface: add CreateSimpleTx to wallet interface 2019-03-15 23:46:51 +01:00
Johan T. Halseth 3ebc66bd16 mock: add CreateSimpleTx to mockWalletController 2019-03-15 23:46:50 +01:00
Johan T. Halseth 6fb664dbe1 lnwallet/btcwallet: implement CreateSimpleTx 2019-03-15 23:46:50 +01:00
Johan T. Halseth fb5b6ff425 autopilot/agent_test: add TestAgentChannelSizeAllocation
TestAgentChannelSizeAllocation tests that the autopilot agent opens
channel of size that stays within the channel budget and size
restrictions.
2019-03-14 08:49:28 +01:00
Johan T. Halseth b71f4632a6 autopilot/agent_test: define testCtx, setup, other helpers
This commit defines a set of helper methods that are used by many of the existing tests.
2019-03-14 08:49:28 +01:00
Johan T. Halseth 4a1e06b204 autopilot/agent: distribute available funds among channels
This commit fixes a regression in how we allocate funds to attempted
channels. We would earlier stay within the channel size limits, but we
wouldn't account for funds consumed by other channels being opened in
parallel.

We fix this by introducing a loop which greadily tries to distribute the
funds among the channels to open, and reduces the number of channels to
open in case not enough funds are available to satisfy the channel size
limits.
2019-03-14 08:49:28 +01:00
Johan T. Halseth cee18892b5 Merge pull request #2565 from joostjager/sendpayment-refactor
routing: sendPayment broken down into multiple functions
2019-03-06 10:20:20 +01:00
Johan T. Halseth 772930343d rpcserver: make listchannels debug log 2019-02-27 12:38:54 -03:00
Johan T. Halseth 0082db4848 travis: use go 1.12.x 2019-02-26 12:19:00 -03:00
Johan T. Halseth b93b4f2974 Merge pull request #2672 from Gfloresechaiz/Gfloresechaiz-patch-1
INSTALL.md : bump to go.1.11.5 on Linux
2019-02-22 12:56:27 +01:00
Johan T. Halseth f00a643ef8 Merge pull request #2634 from halseth/ottosuess-comment_typo_fix
lnrpc: fix minor comment typo
2019-02-21 16:20:33 +01:00
Johan T. Halseth acd458db56 Merge pull request #2549 from halseth/router-ignore-unknown-chanupdate
routing: ignore ChannelUpdates for unknown channels
2019-02-14 15:32:52 +01:00
Johan T. Halseth 01ea797d78 routing/router test: add TestIgnoreChannelEdgePolicyForUnknownChannel 2019-02-14 14:21:18 +01:00
Johan T. Halseth 2b012b06a0 channeldb/graph test: add test for update policy for unknown edge 2019-02-14 14:21:18 +01:00
Johan T. Halseth 23ce82f4e3 routing/router: don't apply channel policy updates for unknown channels 2019-02-14 14:21:18 +01:00
Johan T. Halseth 25f1252019 autopilot/externalscoreattach_test: add TestSetNodeScores 2019-02-14 12:37:25 +01:00
Johan T. Halseth 5dabb1ae29 autopilot+lnrpc: wire up SetNodeScores RPC to set scores of agent 2019-02-14 11:41:47 +01:00
Johan T. Halseth b23e53ea33 autopilot/interface+externalscoreattach: define ScoreSettable
ScoreSettable is an interface that let caller set external scores for
the heuristic. The ExternalScoreAttachment and WeightedCombAttachment
heuristics implement this interface.
2019-02-14 11:41:47 +01:00
Johan T. Halseth 83edcb7153 lnrpc: add API SetScores
Used to set the external scores for the running autopilot agent.
2019-02-14 11:41:47 +01:00
Johan T. Halseth 749d9cccca autopilot/combinedattach: add SetNodeScores
This commit adds a method SetNodesScores to the WeightedCombAttachment
heuristic.

Since the heuristic keeps a list of sub-heuristics, it will attempt to
recursively apply the scores to the sub heuristics.
2019-02-14 11:37:47 +01:00
Johan T. Halseth dff61facf2 autopilot: add ExternalScoreAttachment heuristic
This commit adds a new autopilot heuristic that is scoring based. It is
a simple heuristic that will keep a list of pubkeys and scores, and will
try opening channels with the nodes with the largest score first.
2019-02-14 11:37:47 +01:00
Johan T. Halseth 4fce641d6a Merge pull request #2639 from halseth/routing-remove-unised-nodeindex-chanindex
[trivial] routing: remove unused code, nodeIndex and chanIndex
2019-02-13 19:51:59 +01:00
Johan T. Halseth 1259bacd49 routing: remove unused code, nodeIndex and chanIndex 2019-02-13 12:23:45 +01:00
Johan T. Halseth c1ab49909f Merge pull request #2517 from roeierez/chain_control_cleanup
Proper cleanup neutrino database in case of error
2019-02-07 17:26:44 +01:00
Johan T. Halseth aefc23938c lnd_test: assert num channels before state check
Since the getChanInfo call would require the node to have only one
channel, it made no sense to check the number of channels after calling
it.

Instead we check it first, giving the node time to restart.
2019-02-07 15:42:55 +01:00
Johan T. Halseth b19b26003b lnd_test: disable mempool check on justice tx rebroadcast
By mistake we were checking that only one transaction was in the mempool
when looking for the justice tx, which wasn't always the case, and would
make the test fail.
2019-02-07 15:41:02 +01:00
Johan T. Halseth 81b2e3502e lnd_test: convert assertNumOpenChannelsPending to use waitNoError 2019-02-07 15:38:47 +01:00
Johan T. Halseth 3f3656ae4a lnd_test: assert htlc sweep is mined
To ensure the sweep has properly propagated to the miner and included in
the mined block.
2019-02-07 15:37:49 +01:00
Johan T. Halseth 351865ac67 Merge pull request #2591 from halseth/fndg-dont-spew-shortchanid
[trivial] fundingmanager: don't spew log shortChanID
2019-02-07 11:36:12 +01:00
Johan T. Halseth 4698d18294 fundingmanager: don't spew shortChanID
gives uneccessary output as

2019-02-06 11:26:45.338 [INF] FNDG: Announcing ChannelPoint(cf659a58d68f206531136bf19dea82863a488937f9f4c3d489c450ad81c1724e:0), short_chan_id=(*lnwire.ShortChannelID)(0xc000670a60)(1977:1:0)
2019-02-06 16:04:16 +01:00
Johan T. Halseth 5181f100ed subscribe: add new subscribe package
This commit creates a new package 'subscribe', that exposes a common
Client-Server subscription system, that can be shared among packages.
2019-02-05 18:17:54 -08:00
Johan T. Halseth 49a85b2eb3 autopilot/agent_test: add TestAgentQuitWhenPendingConns
TestAgentQuitWhenPendingConns tests that we are able to stop the autopilot
agent even though there are pending connections to nodes.
2019-02-05 10:45:53 +01:00
Johan T. Halseth c19763c03f autopilot/agent: don't block Stop on pending connetion
To ensure a call to ConnectToPeer doesn't block the agent from
shutting down, we'll launch it in a non-waitgrouped goroutine, that
will signal when a result is returned.
2019-02-05 10:45:53 +01:00
Johan T. Halseth 19ecc19d55 chainnrnfs/neutrino: return on historicalConf error
Would otherwise update height hint cache even on error during rescan.
2019-02-04 21:31:24 +01:00
Johan T. Halseth 5d33d7226c Merge pull request #2477 from cfromknecht/utxo-lnrpc
lnrpc: replace ChanPoint w/ OutPoint in ListUnspent resp
2019-02-04 12:50:57 +01:00
Johan T. Halseth 9d9d148262 utxonursery: use baby expiry as height hint
Previously we would use the best known height as height hint, which
could lead to using a height hint above the actual block it confirms,
hence losing track of the confirmation.
2019-02-04 12:30:05 +01:00
Johan T. Halseth 5d7bb7406f Merge pull request #2568 from cfromknecht/lint-all-travis-builds
Makefile: lint all travis builds
2019-02-04 10:30:07 +01:00
Johan T. Halseth 3daaa8cf74 lndrpc/invoicesrpc+walletrpc: clean up imports 2019-02-02 15:48:22 +01:00
Johan T. Halseth 7dab8b8f2d lnrpc/autopilotrpc: remove unused "os" import
This would cause the build to fail since the import is not used. It was
not detected since the file is under a build flag.
2019-02-02 15:48:15 +01:00
Johan T. Halseth 47918bd6ce lnwallet/channel: add restoration sanity check
To avoid more bugs slipping through where the logIndex is not set, we
panic to catch this. This was earlier done for Adds and the htlcCounter,
which did lead us to find the resulting retoration bug.
2019-01-31 09:24:50 +01:00
Johan T. Halseth 9a0f87fd8e lnwallet/channel_test: add TestFeeUpdateOldDiskFormat
TestFeeUpdateOldDiskFormat tests that we properly recover FeeUpdates
written to disk using the old format, where the logIndex was not
written.
2019-01-31 09:24:50 +01:00
Johan T. Halseth b593c1c7c7 lnwallet/channel: set logIndex for restored FeeUpdate
Earlier versions did not write the log index to disk for fee updates, so
they will be unset. To account for this we set them to to current update
log index.
2019-01-31 09:24:49 +01:00
Johan T. Halseth da42ad245f funding: cap the max_htlc value at channel capacity
We are not longer validating the max_value_in_flight field set by the
remote peer, so it is not always less than the channel capacity anymore.
We therefore make sure to cap it before advertising it.
2019-01-30 09:05:01 +01:00
Johan T. Halseth 6a78141a2d Merge pull request #2536 from cfromknecht/notify-online-log
server: fix notify-online log message
2019-01-25 13:29:03 +01:00
Johan T. Halseth 5306ed5b68 lncli: add autopilot query command
To query the autopilot heuristics for scores.
2019-01-23 09:05:43 +01:00
Johan T. Halseth 8874be764e lnrpc/autopilotrpc: implement QueryScores RPC 2019-01-23 09:05:43 +01:00
Johan T. Halseth a654be5884 lnrpc/autopilotrpc: add QueryScores API
Adds a new lnrpc API that lets the caller get ("dry run") the scores
that would be given to a set of node by the available autopilot
heuristics.
2019-01-23 09:05:43 +01:00
Johan T. Halseth 8f54a2bd6f autopilot/manager: add QueryHeuristics
Proxies a query request to the active agent.
2019-01-23 09:05:43 +01:00
Johan T. Halseth 6c556fd92a autopilot/agent: add queryHeuristics
This commit adds a method queryHeuristic that will query all simple
heuristics for node scores, in addition to the current active heuristic.
2019-01-23 09:05:43 +01:00
Johan T. Halseth cf01879d96 autopilot/agent: protect chanState with mutex
Since we want to access the current channel state outside the main
autopilot agent goroutine, we make sure it is protected by a mutex.
2019-01-23 09:05:42 +01:00
Johan T. Halseth 8ab718368d lnd+pilot+autopilot: use config to set active autopilot heuristics 2019-01-23 09:05:42 +01:00
Johan T. Halseth 36e7694e8e config+pilot: define autopilot.heuristic
And validate the config set by the user.
2019-01-23 09:05:42 +01:00
Johan T. Halseth c0fed861d2 autopilot/interface: add Name() to AttachmentHeuristic interface 2019-01-23 09:05:42 +01:00
Johan T. Halseth 33b2d92b80 lnd_test: don't shadow predErr
Would lead to the printed predErr not being set. We instead use the new
WaitNoError method to avoid this.
2019-01-22 13:41:51 +01:00
Johan T. Halseth 0714ffa0d7 lntest/harness: add WaitNoError 2019-01-22 13:38:05 +01:00
Johan T. Halseth adb512e6bf lntest/node: print amounts in same format 2019-01-22 13:23:30 +01:00
Johan T. Halseth 7d34ce9d08 lnwire+multi: define HasMaxHtlc helper on msgFlags 2019-01-22 08:42:30 +01:00
Johan T. Halseth 4f9de9bf1d fundingmanager_test: add TestFundingManagerRejectInvalidMaxValueInFlight 2019-01-22 08:42:30 +01:00
Johan T. Halseth 4aa52d267f funding+lnwallet: ensure max_htlc_value_in_flight smaller than capacity
Return an error to the remote if larger.
2019-01-22 08:42:29 +01:00
Johan T. Halseth 01e679786d channeldb/graph_test: add TestEdgePolicyMissingMaxHtcl 2019-01-22 08:42:28 +01:00
Johan T. Halseth 6fcc76fc68 channeldb/channel: ignore ChannelEdgePolicy with missing max_htlc
If the max_htlc field is not found when fetching a ChannelEdgePolicy
from the DB, we treat this as an unknown policy.

This is done to ensure we won't propagate invalid data further. The data
will be overwritten with a valid one when we receive an update for this
channel.

It shouldn't be very common, but old data could be lingering in the DB
added before this field was validated.
2019-01-22 08:42:28 +01:00
Johan T. HalsethandValentine Wallace 8dd074ee57 channeldb/graph_test: assert MaxHTLC field correctness
Co-authored-by: Valentine Wallace <valentine.m.wallace@gmail.com>
2019-01-22 08:42:27 +01:00
Johan T. Halseth b9c5248915 channeldb/graph: extract ChannelEdgePolicy serialization 2019-01-22 08:42:27 +01:00
Johan T. Halseth 91c9e45031 channeldb/graph: check correct bucket for nilness 2019-01-22 08:42:27 +01:00
Johan T. Halseth f48c8f91c4 lnd+pilot: use WeightedCombAttachment
We make the default autopilot agent use the WeightedCombAttachment.
Currently it uses only one sub-heuristic, prefAttachment.
2019-01-21 09:44:38 +01:00
Johan T. Halseth bdbadeaa75 autopilot: add WeightedCombAttachment
This commit defines a new heuristic WeightedCombAttachment that takes a
set of sub-heuristics, and produces a final node score by querying the
sub-heuristics and combining the scores from them according to their
weights.

This way it will look like a regular, single heuristic to the autopilot
agemnt, but can be a more complex combination of several.
2019-01-21 09:44:38 +01:00
Johan T. Halseth 592ce92c72 autopilot/interface+prefattach: scale node scores to range [0.0, 1.0]
To prepare for combinning scores from multiple heuristics, we require the
scores returned from the NodeSores API to be in the range [0.0, 1.0].

The prefAttach heuristic is altered to scale the returned scores such
that the most connected node in the grpah is given a score of 1.0.
2019-01-21 09:44:37 +01:00
Johan T. Halseth 4cbc6e6e07 make: build lnd-itest before flakehunting 2019-01-17 14:40:20 +01:00
Johan T. Halseth 8af2473644 channeldb/addr_test: add tests for invalid onion addresses 2019-01-17 14:16:15 +01:00
Johan T. Halseth 6a3e1423d2 channeldb/addr: sanity check onion address length before writing to db 2019-01-17 14:16:15 +01:00
Johan T. Halseth e2e00f9dd2 channeldb/addr_test: add invalid TCP cases
These are invalid length IP addresses that earlier would not fail to
serialize.
2019-01-17 14:16:15 +01:00
Johan T. Halseth 02b7bb356a channeldb/addr: validate ip before writing 2019-01-17 14:16:12 +01:00
Johan T. Halseth 6f605b2de2 channeldb/addr_test: inspect error string
Lets us match on more than static errors.
2019-01-17 14:14:24 +01:00
Johan T. Halseth 5dc87ad4d7 gitignore: ignore .minerlogs folder 2019-01-16 10:11:47 +01:00
Johan T. Halseth 2b16fb7271 lnd_test: fix reorg test by using new Node RPC
Since the chain backend and miner is now seperate nodes, the reorg test
must be slightly rewritten. We use the Btcd Node RPC to connect and
disconnect the three bitcoin nodes in question (chain backend, miner,
temp miner) to control the reorg scenario.
2019-01-16 10:10:22 +01:00
Johan T. Halseth 92b984a233 lnd_test+lntest: seperate miner and chain backend
Since we are no longer passing in the miner as the chain backend, we
don't have to export the fields.
2019-01-16 10:10:22 +01:00