Commit Graph

7108 Commits

Author SHA1 Message Date
Conner Fromknecht
28bf49807e
watchtower/wtdb: add CSessionStatus field to ClientSession
This commit adds persisted status bit-field to ClientSessions, that can
be used to modify behavior of their handling in the client. Currently,
only a default CSessionActive status is defined. However, the intention
is that this could later be used to signal that a session is abandoned
without needing to perform a db migration to add the field. As we move
forward with testing, this will likely be useful if a session gets
borked and we need a simple method of the client to temporarily ignore
certain sessions.

The field may be useful in signaling other types of status changes,
though this was the primary motivation that warranted the addition.
2019-05-24 18:24:41 -07:00
Conner Fromknecht
9157c88f93
watchtower/wtclient: dedup backups across restarts
Now that the committed and acked updates are persisted across restarts,
we will use them to filter out duplicate commit heights presented by the
client.
2019-05-24 18:24:41 -07:00
Conner Fromknecht
3be651b0b3
watchtower/wtdb: add ClientDB
This commit adds the full bbolt-backed client database as well as a set
of unit tests to assert that it exactly implements the same behavior as
the mock ClientDB.
2019-05-24 18:24:41 -07:00
Conner Fromknecht
b35a5b8892
watchtower/wtclient: integrate ClientChannelSummaries
In this commit, we utilize the more generic ClientChanSummary instead of
exposing methods that only allow us to set and fetch sweep pkscripts.
2019-05-23 20:48:50 -07:00
Conner Fromknecht
25fc464a6e
watchtower/wtdb/client_chan_summary: add ClientChanSummary
A ClientChanSummary will be inserted for each channel registered with
the client, which for now will just track the sweep pkscript to use. In
the future, this will be extended with additional information to enable
the client to efficiently compute which historical states need to be
backed up under a given policy.
2019-05-23 20:48:36 -07:00
Conner Fromknecht
440ae7818a
watchtower/wtmock/client_db: adjust mock clientdb behavior
In advance of the upcoming wtdb.ClientDB, we'll modify the behavior
of the mockdb to be more like the final bbolt backed one, and assert
that all or our tests are still passing.
2019-05-23 20:48:23 -07:00
Conner Fromknecht
2a904cb69f
watchtower/wtdb: add Encode/Decode methods to wtclient structs 2019-05-23 20:48:08 -07:00
Conner Fromknecht
1db9bf2fd4
watchtower/wtdb: create embedded ClientSessionBody
This commit splits out the portions of the ClientSession into an
embedded ClientSessionBody, since these fields will be serialized
together on-disk.
2019-05-23 20:47:49 -07:00
Conner Fromknecht
5ad9530502
watchtower/wtdb: return sorted ClientSession.CommittedUpdates
This commit replaces the map-based CommittedUpdates field with a slice.
When reading from disk, these will already be sorted by bbolt, so the
client restore the updates as presented without needing to sort them
first.

Since the key in the map variant was the sequence number, we refactor
the CommittedUpdate struct to have a sequence number and an embedded
CommittedUpdateBody (which is equivalent to the old CommittedUpdate).
The database is then expected to populate the sequence number from the
key on disk.

Since the sequence number is now directly integrated in the
CommittedUpdate struct, this allow allows us to remove the now redundant
seqNum argument from CommitUpdate.
2019-05-23 20:47:36 -07:00
Conner Fromknecht
3509c0c991
watchtower/multi: use proper TowerID type
This allows serialization methods to be added with TowerID method
receivers.
2019-05-23 20:47:22 -07:00
Conner Fromknecht
ec7c16fdc1
watchtower/wtdb: prepare for addition of client db
This commit renames the variables dbName to towerDBName and dbVersions
to towerDBVersions, to distinguish between the upcoming clientDBName
clientDBVersions. We also move resusable portions of the database
initialization and default endianness to its own file so that it can be
shared between both tower and client databases.
2019-05-23 20:47:08 -07:00
Wilmer Paulino
6e0084fec9
Merge pull request #3075 from cfromknecht/crtr-nil-path-curves
routing/router: nil path pubkeys before spewing
2019-05-23 20:01:54 -07:00
Olaoluwa Osuntokun
50f0ac5683
Merge pull request #2308 from chokoboko/channels-in-getnodeinfo
rpcserver: add channels to GetNodeInfo response
2019-05-23 18:01:12 -07:00
chokoboko
51dc422721 rpcserver: add channels to GetNodeInfo response 2019-05-23 16:03:39 +03:00
Johan T. Halseth
6cd71b7f7a
Merge pull request #2312 from xsb/color-node-update
rpc: add node color to NodeUpdate and GetInfo
2019-05-23 14:21:05 +02:00
Xavi Soler
0e38c722b3
lncli: include color in getinfo response 2019-05-23 10:52:22 +02:00
Xavi Soler
f4f3cea9a6
rpcserver: include color to getinfo and topology update 2019-05-23 10:52:18 +02:00
Xavi Soler
28021361d1
routing: add color to node update 2019-05-23 10:52:12 +02:00
Xavi Soler
ee2e49141e
lnrpc: add color to GetInfoResponse and NodeUpdate 2019-05-23 10:51:59 +02:00
Olaoluwa Osuntokun
063ecedf3a
Merge pull request #3082 from joostjager/upgrade-gen-go
lnrpc: upgrade to protobuf v1.3.1
2019-05-22 21:10:26 -07:00
Olaoluwa Osuntokun
649b5208a6
Merge pull request #3111 from cfromknecht/fix-bitcoind-initial-install
scripts/install_bitcoind: fix initial install
2019-05-22 20:06:49 -07:00
Conner Fromknecht
b34150144d
scripts/install_bitcoind: fix initial install 2019-05-22 19:21:24 -07:00
Olaoluwa Osuntokun
c654b829f4
Merge pull request #3104 from wpaulino/lncli-create-restore-backup
cmd/lncli: properly parse channel backup within lncli create
2019-05-22 17:12:25 -07:00
Olaoluwa Osuntokun
0afc70ec67
Merge pull request #3108 from cfromknecht/build-bitcoind-0.17
travis: install bitcoind 0.17.1 binaries manually
2019-05-22 16:58:11 -07:00
Conner Fromknecht
98f8696e68
travis: install bitcoind 0.17.1 binaries 2019-05-22 16:35:46 -07:00
Johan T. Halseth
4806003b74
Merge pull request #2704 from MDrollette/multiple-opts
config: allow adding multiple tls ips and domains
2019-05-22 08:59:19 +02:00
Johan T. Halseth
437f83998e
Merge pull request #3098 from cfromknecht/increase-funding-timeout
fundingmanager: bump max non-initiator funding timeout to 2 weeks
2019-05-22 08:46:54 +02:00
Wilmer Paulino
92d780f157
cmd/lncli: properly parse channel backup within lncli create 2019-05-21 15:16:44 -07:00
Johan T. Halseth
339080394d
Merge pull request #3096 from grunch/add-minchansize-to-sample-conf
Add minchansize to sample config file
2019-05-21 09:52:03 +02:00
Olaoluwa Osuntokun
57715b5192
Merge pull request #3093 from wpaulino/lncli-openchannel-unconfirmed
cmd/lncli: properly spend unconfirmed utxos with openchannel
2019-05-20 18:07:04 -07:00
Joost Jager
9a4c0d5699
lnrpc: upgrade to protobuf v1.3.1
This commit upgrades the protobuf version. Compared to the previous
v1.2.0 it generates smaller diffs in generated code. This change was
introduced in:

fffb0f7828
2019-05-20 15:35:14 +02:00
Johan T. Halseth
777f1b7b23
Merge pull request #3076 from sangaman/proto-typos
lnrpc: fix typos
2019-05-20 15:00:55 +02:00
Johan T. Halseth
2c1c29e060
Merge pull request #3081 from halseth/route-remove-totalfees
routing/route+multi: remove redundant TotalFees field
2019-05-20 15:00:01 +02:00
Johan T. Halseth
60bad9a4e5
Merge pull request #2974 from OpinionatedGeek/patch-1
Build LND subservers when building docker image
2019-05-20 14:40:53 +02:00
Conner Fromknecht
08654786ad
fundingmanager: bump max non-initiator funding timeout to 2 weeks
The previous value was set to two days, which may not be enough to
handle large fee spikes where users still which to submit channels with
a low fee and don't mind lowering their time preference. Since the
timeout is only applied to channels that we don't initiate, there's real
downside since it's not our funds that are locked up.
2019-05-18 15:21:56 -07:00
Francisco Calderón
8a31da9d09
Add minchansize to sample config file 2019-05-18 12:31:32 -03:00
Olaoluwa Osuntokun
f20ab2fc7b
Merge pull request #3090 from cfromknecht/range-loop-fixes
utxonursery+chanbackup: fix range loop binding bugs
2019-05-17 15:50:54 -07:00
Olaoluwa Osuntokun
30cb667ee2
Merge pull request #3063 from halseth/router-error-deobfuscation
[reliable payments] Move payment error deobfuscation to router
2019-05-17 14:04:51 -07:00
Wilmer Paulino
8628019ca2
cmd/lncli: properly spend unconfirmed utxos with openchannel 2019-05-17 13:10:12 -07:00
Conner Fromknecht
17ab813dcf
utxonursery+chanbackup: fix range loop binding bugs 2019-05-16 20:37:30 -07:00
Johan T. Halseth
15bed506b1
routing/route+multi: remove redundant TotalFees field
Instead get it on demand using method TotalFees().
2019-05-16 23:58:32 +02:00
Johan T. Halseth
cd02c22977
htlcswitch+router: move deobfuscator creation to GetPaymentResult call
In this commit we move handing the deobfuscator from the router to the
switch from when the payment is initiated, to when the result is
queried.

We do this because only the router can recreate the deobfuscator after a
restart, and we are preparing for being able to handle results across
restarts.

Since the deobfuscator cannot be nil anymore, we can also get rid of
that special case.
2019-05-16 23:56:12 +02:00
Johan T. Halseth
f99d0c4c68
htlcswitch/switch+payment_result: define networkResult, extractResult 2019-05-16 23:56:12 +02:00
Johan T. Halseth
5a8b892bb6
routing/router: extract sessionKey generation
We extract the session key such that we can later store it across
restarts.
2019-05-16 23:56:12 +02:00
Johan T. Halseth
ec087a9f73
htlcswitch+router: define PaymentResult, GetPaymentResult
This lets us distinguish an critical error from a actual payment result
(success or failure). This is important since we know that we can only
attempt another payment when a final result from the previous payment
attempt is received.
2019-05-16 23:56:12 +02:00
Johan T. Halseth
be129eb7c7
htlcswitch/switch: remove numPendingPayments only used in tests 2019-05-16 23:56:12 +02:00
Johan T. Halseth
cff4d3547d
htlcswitch/switch: clarify paymentID uniqueness
With the following commits, it'll become important to not resuse
paymentIDs, since there is no way to tell whether the HTLC in question
has already been forwarded and settled/failed.

We clarify this in the SendHTLC comments, and alter the tests to not
attempt to resend an HTLC with a duplicate payment ID.
2019-05-16 23:56:11 +02:00
Johan T. Halseth
bbbe3a37f5
htlcswitch/switch: make parseFailedPayment not dependent on pkt
We will later persist the fields necessary to decrypt a received error.
2019-05-16 23:56:11 +02:00
Johan T. Halseth
ed81cec0fa
routing/router: remove sendToSwitch method 2019-05-16 23:56:11 +02:00
Johan T. Halseth
c9e8ff6a34
switch+router+server: move NextPaymentID to router
This commit moves the responsibility of generating a unique payment ID
from the switch to the router. This will make it easier for the router
to keep track of which HTLCs were successfully forwarded onto the
network, as it can query the switch for existing HTLCs as long as the
paymentIDs are kept.

The router is expected to maintain a map from paymentHash->paymentID,
such that they can be replayed on restart. This also lets the router
check the status of a sent payment after a restart, by querying the
switch for the paymentID in question.
2019-05-16 23:56:06 +02:00