Commit Graph

6523 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
4ad175c16d
sweep: update getInputWitnessSizeUpperBound to be aware of nested p2sh
In this commit, we update the `getInputWitnessSizeUpperBound` and all
its callers to be aware of nested p2sh witness inputs. We do so by
adding another bool which is true if the output is a nested p2sh output.
If so, then in order to properly estimate the total weight, the caller
needs to factor in the non-witness data of the additional sigScript data
push.
2019-01-09 15:55:22 -08:00
Olaoluwa Osuntokun
40f0dbb5e6
lnwallet: add witness generation functions for p2wkh and np2wkh types 2019-01-09 15:55:21 -08:00
Olaoluwa Osuntokun
c18e166e03
lnwallet+sweep: extend the WitnessGenerator type to return an InputScript
In this commit, we extend the WitnessGenerator type to now return an
InputScript. This allows it to be more encompassing, as now callers can
expect a sigScript to be populated if the input being swept requires a
sigScript field.

Along the way, we've also renamed input.BuildWitness to
input.CraftInputScript.  We also take a step towards allowing the
sweeper to sweep transactions for n2pwkh outputs. We do so by modifying
the BuiltWitness method to instead return an InputScript. Additionally,
when populating inputs if a sigScript is present, it will now be
populated.
2019-01-09 15:55:19 -08:00
Olaoluwa Osuntokun
bd9ebbd5af
lnwallet: add more godoc to InputScript rename ScriptSig field to SigScript 2019-01-09 15:55:18 -08:00
Olaoluwa Osuntokun
73c9c2ee15
sweep+cnct+nursery+rpc: extract DetermineFeePerKw to func, add FeePreference
In this commit, we extract the existing determineFeePerKw method on the
RPC server into a new file in the sweep package. Along the way, we
consolidate code by introducing a new FeePreference struct, which allows
the caller to express their fee preference either in blocks to
confirmation, or a direct fee rate. This move takes a small step to
father decoupling calls in the main RPC server.
2019-01-09 15:55:17 -08:00
Olaoluwa Osuntokun
77262ff699 sweep: rename Estimator to FeeEstimator 2019-01-09 15:55:01 -08:00
Olaoluwa Osuntokun
b6fe6059a1
Merge pull request #2433 from cfromknecht/lookout-txid-logging
watchtower/lookout: correct txid + session id logging
2019-01-09 15:53:49 -08:00
Conner Fromknecht
97f4f10355
log: initialize NANN logger for netann pkg 2019-01-09 13:31:39 -08:00
Conner Fromknecht
4c8b64d2a6
netann/log: add NANN logger 2019-01-09 13:29:46 -08:00
Olaoluwa Osuntokun
a0c0e8edc9
Merge pull request #2341 from halseth/autopilot-weighted-heuristics
[autopilot] Decouple agent constraints from heuristics
2019-01-08 20:15:57 -08:00
Conner Fromknecht
7987a41c0d
nodesigner: remove file, now in netann pkg 2019-01-08 16:18:55 -08:00
Conner Fromknecht
32041e703b
server: replace nodeSigner in main with netann.NodeSigner 2019-01-08 16:18:39 -08:00
Conner Fromknecht
30441871d3
netann/node_signer: copy and export NodeSigner from main 2019-01-08 16:18:06 -08:00
Johan T. Halseth
3ab01898fb
Merge pull request #2417 from cfromknecht/min-backoff
server: configurable min backoff
2019-01-08 15:07:50 +01:00
Johan T. Halseth
5c41243f35
Merge pull request #2118 from halseth/make-fmt-2
make: ensure make fmt is run with -s flag
2019-01-08 10:32:34 +01:00
Johan T. Halseth
5b1e72a019
autopilot/interface+agent: return NodeScore from NodeScores
Since NodeScores no longer returns fully populated AttachmentDirectives,
we make this explicit by defining a new type NodeScore that includes a
subset of what the AttachmentDirective does.
2019-01-08 10:23:50 +01:00
Johan T. Halseth
25de66d27b
autopilot/interface+choice: add NodeScore type
We create a new type NodeScore which is a tuple (NodeID, score). The
weightedChoice and chooseN algorithms are altered to expect this type.

This is done in order to simplify the types we are using, since we were
only using a subset of the fields in AttachmentDirective.
2019-01-08 10:23:48 +01:00
Johan T. Halseth
3739c19ef8
autopilot/pref_attachment: rename ConstrainedPrefAttachment->PrefAttachment
Since the ConstrainedPrefAttachment no longers require the heuristic to
be aware of the autopilot constraints, we rename it PrefAttachment.
2019-01-08 10:10:59 +01:00
Johan T. Halseth
ccf4b7feab
autopilot: move address lookup from heuristic to agent
To avoid having the heuristics deal with (possibly conflicting) address
lookups, we let the agent handle them.
2019-01-08 10:10:59 +01:00
Johan T. Halseth
cfd237bf1f
autopilot: move determining chanSize from heuristic to agent
Since we want to combine scores from multiple heuristics, things get
complicated if the heuristics report their own individual channel sizes.
Therefore we change the NodeScores interface slightly, letting the agent
specify the wanted channel size, and let the heuristic score the nodes
accordingly.
2019-01-08 10:10:59 +01:00
Johan T. Halseth
d5f3714f86
autopilot/agent: return early if no funds available
If there are less funds available than the minumum channel size, there's
no reason to score candidates, so we continue early.
2019-01-08 10:10:59 +01:00
Johan T. Halseth
d0c4e253c6
autopilot/interface: remove NeedMoreChans from AttachmentHeuristic
Since the agent is now querying the constraints directly, NeedMoreChans
is no longer needed on the heuristic.
2019-01-08 10:10:59 +01:00
Johan T. Halseth
fbfc9a53af
autopilot: TestConstrainedPrefAttachmentNeedMoreChan->TestConstraintsChannelBudget
Since the constraints are no longer something the heuristic needs to be
aware of, we move the test.
2019-01-08 10:10:58 +01:00
Johan T. Halseth
0e1713956b
autopilot/agent: call ChannelBudget on constrainsts
We let the agent call ChannelBudget on its constraints directly, and
not go through the heuristic. This is needed since when we want to have
multiple active heuristics concurrently, it won't make sense anymore to
ask each of the heuristics.

The mockConstraints are also updated to act as the mockHeuristic did
before, by making it possible to control the responses it gives by
sending them on the contained channels.
2019-01-08 10:10:58 +01:00
Johan T. Halseth
1d82e12fcf
autopilot: define AgentConstraints
To decouple the autopilot heuristic from the constraints, we start by
abstracting them behind an interface to make them easier to mock. We
also rename them HeuristicConstraints->AgentConstraints to make it clear
that they are now constraints the agent must adhere to.
2019-01-08 10:10:58 +01:00
Olaoluwa Osuntokun
21460c9e67
Merge pull request #2293 from halseth/unit-tests-weighted-choice
[autopilot] weighted choice unit tests and optimizations
2019-01-07 19:42:29 -08:00
Olaoluwa Osuntokun
0725fecc12
Merge pull request #2412 from Roasbeef/node-alias-validation
lnwire+peer: fully validate node aliases on the wire, don't d/c due to invalid aliases
2019-01-07 19:35:39 -08:00
Conner Fromknecht
bb8469d8ee
watchtower/lookout: correct txid + session id logging 2019-01-07 19:20:45 -08:00
Conner Fromknecht
75ec66d9b3
Merge pull request #1975 from halseth/fwdtrigger-force
[tests] Force tick on FwdEventTicker
2019-01-07 17:46:58 -08:00
Conner Fromknecht
088fb33718
contractcourt: nil keyring curves on breach info 2019-01-07 17:15:45 -08:00
Conner Fromknecht
cd54625c2d
lnwallet/channel: add keyring + remote csv to breach info 2019-01-07 17:15:33 -08:00
Olaoluwa Osuntokun
154a8a95d8
Merge pull request #2424 from alexbosworth/patch-7
lnwallet: fix trivial comment typo
2019-01-07 17:02:29 -08:00
Olaoluwa Osuntokun
4ac54dce25
Merge pull request #2355 from joostjager/move-invoices
invoices: create package
2019-01-07 16:56:22 -08:00
Olaoluwa Osuntokun
0c893c66fb
Merge pull request #2399 from joostjager/getinfo-network-name
lnrpc: expose network name in GetInfo
2019-01-07 16:01:28 -08:00
Joost Jager
649408003d
lnrpc: expose network name in GetInfo
Previously only a testnet boolean was available which
made it impossible to distinguish between regtest and
mainnet.
2019-01-08 00:17:14 +01:00
Joost Jager
c1eaf60000
invoices: create package
This commit isolates the invoice registry in a separate package. It is
a preparation for the creation of an invoices sub server.
2019-01-07 23:04:05 +01:00
Olaoluwa Osuntokun
f63ab4beda
Merge pull request #2360 from joostjager/invoice-unused-fields
channeldb+lnrpc: remove receipt invoice field
2019-01-07 13:47:00 -08:00
Joost Jager
d151916ae1
lnrpc: deprecate invoice receipt field 2019-01-07 22:05:52 +01:00
Olaoluwa Osuntokun
a49e39de75
peer: don't d/c on invalid node alias 2019-01-07 12:53:45 -08:00
Olaoluwa Osuntokun
1821773e39
lnwire: add test cases for node alias validation 2019-01-07 12:53:40 -08:00
Olaoluwa Osuntokun
0b10f4c4d8 lnwire: when reading node aliases, properly check validity
In this commit, we ensure that when we read node aliases from the wire,
we ensure that they're valid. Before this commit, we would read the raw
bytes without checking for validity which could result in us writing in
invalid node alias to disk. We've fixed this, and also updated the
quickcheck tests to generate valid strings.
2019-01-07 12:53:10 -08:00
Alex Bosworth
a78e13929e
lnwallet: fix trivial comment typo 2019-01-06 11:39:12 -08:00
Olaoluwa Osuntokun
3c950e8f0d
Merge pull request #2368 from Roasbeef/static-chan-backups-keychain
keychain: extend DerivePrivKey to derive based on pubkey+KeyFamily
2019-01-04 18:01:47 -08:00
Olaoluwa Osuntokun
2e2d5fcf54
Merge pull request #2354 from joostjager/invoice-state
channeldb+lnrpc: invoice state
2019-01-04 14:48:17 -08:00
Olaoluwa Osuntokun
6787ba2653
Merge pull request #2248 from wpaulino/fetch-waiting-close-channels
channeldb/db: prevent filtering channels with unconfirmed close txs
2019-01-04 14:45:05 -08:00
Olaoluwa Osuntokun
6589f686ad
Merge pull request #2400 from Roasbeef/fix-release-script
build: fix release script to include commit hash
2019-01-04 14:42:54 -08:00
Olaoluwa Osuntokun
e86babe133
keychain: extend DerivePrivKey to derive based on pubkey+KeyFamily
In this commit, we extend the DerivePrivKey method to allow callers that
don't know the full KeyLocator information to attempt to derive a
private key via a brute force mechanism. If we don't now the full
KeyLoactor, then given the KeyFamily, we can walk down the derivation
path and compare keys one by one. In order to ensure we don' t enter an
infinite loop when given an unknown public key, we cap the number of
keys derived at 100k.

An upcoming feature to lnd that adds static channel backups will utilize
this feature, as we need to derive the shachain root given only the
public key and key family, as we don't currently store this KeyLocator
on disk.
2019-01-04 14:41:41 -08:00
Olaoluwa Osuntokun
0f43cdfc74
Merge pull request #2414 from webworker01/patch-1
Fix TOC link
2019-01-04 14:23:57 -08:00
Conner Fromknecht
3a2bd124ae
rpcserver: add connectpeer log, fix existing formatting 2019-01-04 14:07:43 -08:00
Conner Fromknecht
d3b5326ae7
server: use cfg.MinBackoff instead of defaultBackoff 2019-01-04 14:05:29 -08:00