Commit Graph

9028 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
f29169e7d6
Merge pull request #4000 from joostjager/payment-raw-failure
routing+channeldb: mpp bucket structure
2020-03-09 18:57:04 -07:00
Conner Fromknecht
852ab592bb
Merge pull request #4034 from cfromknecht/nested-size-fix
input/size: correct NP2WKH and NP2SH input count
2020-03-09 18:24:52 -07:00
Olaoluwa Osuntokun
5ba630f02b
Merge pull request #3963 from guggero/safety-doc
doc: add Operational Safety Guidelines document
2020-03-09 17:39:03 -07:00
Olaoluwa Osuntokun
462048ae81
Merge pull request #1895 from Crypt-iQ/lnwire_fuzzing_09_11_2018
fuzz: new fuzz package and lnwire parsing harnesses
2020-03-09 17:23:19 -07:00
Olaoluwa Osuntokun
cbef26b9f6
Merge pull request #3993 from guggero/unconfirmed-chanbackup
chanbackup: update on-disk backup file with unconfirmed channels
2020-03-09 17:18:23 -07:00
Joost Jager
c0cb05d7b4
lnrpc: expose raw htlc failure
Adds a new rpc field to the payment htlc proto message and populates it
with data that is now stored in the db.
2020-03-09 18:31:41 +01:00
Joost Jager
866623e84b
channeldb/migration13: migrate to mpp structure
This commit migrates the payments in the database to a new structure
that allows for multiple htlcs per payments. The migration introduces a
new sub-bucket that contains a list of htlcs and moves the old single
htlc into that.
2020-03-09 18:31:39 +01:00
Joost Jager
4cea2d5213
channeldb/migtest: add migration test tools
This commit adds test helper code to dump, restore and verify the
low-level bbolt database structure.
2020-03-09 18:31:37 +01:00
Joost Jager
f86e68a1a2
channeldb+routing: store full htlc failure reason
This commit extends the htlc fail info with the full failure reason that
was received over the wire. In a later commit, this info will also be
exposed on the rpc interface. Furthermore it serves as a building block
to make SendToRoute reliable across restarts.
2020-03-09 18:31:35 +01:00
Joost Jager
48c0e42c26
channeldb+routing: store all payment htlcs
This commit converts the database structure of a payment so that it can
not just store the last htlc attempt, but all attempts that have been
made. This is a preparation for mpp sending.

In addition to that, we now also persist the fail time of an htlc. In a
later commit, the full failure reason will be added as well.

A key change is made to the control tower interface. Previously the
control tower wasn't aware of individual htlc outcomes. The payment
remained in-flight with the latest attempt recorded, but an outcome was
only set when the payment finished. With this commit, the outcome of
every htlc is expected by the control tower and recorded in the
database.

Co-authored-by: Johan T. Halseth <johanth@gmail.com>
2020-03-09 18:31:33 +01:00
Joost Jager
8558534417
routing: add clock to router config 2020-03-09 11:43:44 +01:00
Joost Jager
c357511051
channeldb/migtest: remove channeldb dependency
Removes this unnecessary dependency allowing migration code to use
utility functions from channeldb/migtest.
2020-03-09 11:43:42 +01:00
Joost Jager
4c74c0817e
channeldb/test: extend payment control test with failed attempt 2020-03-09 11:43:40 +01:00
Joost Jager
fa3a762a2c
channeldb: add error return value to fetchPaymentStatus
Preparation for when we need to return errors in a next commit.
2020-03-09 11:43:38 +01:00
Joost Jager
e6e9e44e6f
routerrpc: extract wire error marshalling
Preparation for marshalling wire errors as part of rpc payment lookups.
2020-03-09 11:43:36 +01:00
Joost Jager
3f5ba35dea
routerrpc: move marshall functions out of conditionally compiled file
These functions will (indirectly) be called by the main rpc server and
can no longer stay conditionally compiled.
2020-03-09 11:43:34 +01:00
Joost Jager
6aab6c0bac
routerrpc+lnrpc: move htlc failure messages
In a later commit, htlc raw failure messages will be exposed through the
main rpc. This is a preparation for that.
2020-03-09 11:43:32 +01:00
Joost Jager
cc5e18c487
channeldb: isolate duplicate payments
Duplicate payments is legacy that we keep alive for accounting purposes.
This commit isolates the deserialization logic for duplicate payments in
its own file, so that regular payment logic and db structure can evolve
without needing to handle/migrate the legacy data.
2020-03-09 11:43:30 +01:00
Joost Jager
c29b74168f
channeldb/test: refactor payment control test
Previously this was tested as a white box. Database access methods were
duplicated as test code and compared to the return value of the code
under test. This approaches leads to brittle test because it relies
heavily on implementation details. This commit changes this and prepares
for additional test coverage being added in later commits.
2020-03-09 11:43:28 +01:00
Johan T. Halseth
bee2380441
channeldb: rename PaymentAttemptInfo to HTLCAttemptInfo
To better distinguish payments from HTLCs, we rename the attempt info
struct to HTLCAttemptInfo. We also embed it into the HTLCAttempt struct,
to avoid having to duplicate this information.

The paymentID term is renamed to attemptID.
2020-03-09 11:43:26 +01:00
Joost Jager
967b4b2dc3
channeldb: remove redundant MPPaymentCreationInfo struct
MPPaymentCreationInfo and PaymentCreationInfo are identical except for
the naming of CreationTime/CreationDate.
2020-03-09 11:43:24 +01:00
Conner Fromknecht
8a5d846f94
Merge pull request #3996 from guggero/lncli-json
lncli+proto: use original name in jsonpb marshaler and remove json_name fields in proto
2020-03-07 11:08:14 -08:00
Oliver Gugger
9aff896b10
lnrpc+rpcserver+lncli: rename RPC fields to previous JSON name 2020-03-07 11:24:13 +01:00
Oliver Gugger
3a5348ea8b
wtclientrpc: format wtclient.proto and remove json_name fields
We now use the jsonpb marshaler to convert the RPC responses to
JSON in lncli and REST. The jsonpb has a setting to use the
original name as defined in the proto file and the explicit
json_name definition is not necessary any more.
The jsonpb setting is called OrigName and needs to be true.
2020-03-07 11:23:09 +01:00
Oliver Gugger
ad0fba548f
watchtowerrpc: format watchtower.proto and remove json_name fields
We now use the jsonpb marshaler to convert the RPC responses to
JSON in lncli and REST. The jsonpb has a setting to use the
original name as defined in the proto file and the explicit
json_name definition is not necessary any more.
The jsonpb setting is called OrigName and needs to be true.
2020-03-07 11:23:09 +01:00
Oliver Gugger
54fede0ae9
walletrpc: format walletkit.proto and remove json_name fields
We now use the jsonpb marshaler to convert the RPC responses to
JSON in lncli and REST. The jsonpb has a setting to use the
original name as defined in the proto file and the explicit
json_name definition is not necessary any more.
The jsonpb setting is called OrigName and needs to be true.
2020-03-07 11:23:08 +01:00
Oliver Gugger
5a35ffa395
signrpc: format signer.proto 2020-03-07 11:23:08 +01:00
Oliver Gugger
1b543f0d50
routerrpc: format router.proto and remove json_name fields
We now use the jsonpb marshaler to convert the RPC responses to
JSON in lncli and REST. The jsonpb has a setting to use the
original name as defined in the proto file and the explicit
json_name definition is not necessary any more.
The jsonpb setting is called OrigName and needs to be true.
2020-03-07 11:23:07 +01:00
Oliver Gugger
5a6fea31d9
invoicesrpc: format invoices.proto and remove json_name fields
We now use the jsonpb marshaler to convert the RPC responses to
JSON in lncli and REST. The jsonpb has a setting to use the
original name as defined in the proto file and the explicit
json_name definition is not necessary any more.
The jsonpb setting is called OrigName and needs to be true.
2020-03-07 11:23:07 +01:00
Oliver Gugger
23f5472cd3
chainrpc: format chainnotifier.proto 2020-03-07 11:23:06 +01:00
Oliver Gugger
bcfe92cee1
autopilotrpc: format autopilot.proto and remove json_name fields
We now use the jsonpb marshaler to convert the RPC responses to
JSON in lncli and REST. The jsonpb has a setting to use the
original name as defined in the proto file and the explicit
json_name definition is not necessary any more.
The jsonpb setting is called OrigName and needs to be true.
2020-03-07 11:23:06 +01:00
Oliver Gugger
b99a457dd0
lnrpc: format rpc.proto and remove json_name fields
We now use the jsonpb marshaler to convert the RPC responses to
JSON in lncli and REST. The jsonpb has a setting to use the
original name as defined in the proto file and the explicit
json_name definition is not necessary any more.
The jsonpb setting is called OrigName and needs to be true.
2020-03-07 11:23:06 +01:00
Oliver Gugger
e435cd5fc6
lncli: use original snake_case names for JSON serializing
Because we now use printRespJSON everywhere where we print RPC
responses as JSON, we can simply instruct the jsonpb marshaler to
use the original snake_case name specified in the proto file for
the JSON field names and not the default camelCase.
2020-03-07 11:22:36 +01:00
Oliver Gugger
165769ea82
lncli: use printRespJSON for probability response 2020-03-07 11:22:35 +01:00
Conner Fromknecht
ecf7d82904
Merge pull request #4055 from cfromknecht/remove-failed-channels
peer: remove unused failedChannels channels map
2020-03-06 16:50:57 -08:00
Conner Fromknecht
e4090c3c67
peer: remove unused failedChannels channels map 2020-03-06 15:45:34 -08:00
Conner Fromknecht
089953ea97
Merge pull request #4045 from cfromknecht/list-channels-with
cmd/lncli: add --with flag to list channels
2020-03-06 12:38:34 -08:00
Oliver Gugger
092a0b4a0a
Merge pull request #4053 from turcane/master
sample-lnd.conf: remove deprecated wtclient option
2020-03-06 09:02:22 +01:00
Conner Fromknecht
11532df5f3
cmd/lncli: add --peer flag to list channels
This commit adds a flag to listchannels that filters by remote pubkey.
2020-03-05 20:44:18 -08:00
Conner Fromknecht
c2ec4a450d
Merge pull request #4040 from cfromknecht/fee-report-sid
lnrpc+rpcserver: expose short chan id on feereport
2020-03-05 20:16:11 -08:00
Ediz Turcan
a520008960
sample-lnd.conf: missing full stop added (typo) 2020-03-05 22:08:38 +01:00
Ediz Turcan
bf5ccce786
sample-lnd.conf: remove deprecated wtclient option 2020-03-05 20:33:37 +01:00
Conner Fromknecht
5c9b336a61
lnrpc+rpcserver: expose short chan id on feereport
This commit adds each channel's short chan id to the `feereport` rpc.
Without this, it can be tedious to lookup more info about a particular
channel since most rpcs only accept short chan ids and not channel
points. For instance, now one can take a channel id from `feereport` and
look it up directly via `getchaninfo` to examine the policy in more
detail.
2020-03-04 15:37:17 -08:00
Conner Fromknecht
4c2bc7bc79
lnwallet+input: move size_test.go to input pkg 2020-03-04 08:01:37 -08:00
Conner Fromknecht
4c402ab9d4
lnwallet/size_test: refactor and expand unit tests 2020-03-04 08:00:48 -08:00
Conner Fromknecht
6eb7f2800d
input/size: correct NP2WKH and NP2SH input count
This commit corrects a bug in TxWeightEstimator that could result in
underestimations for transactions involving NestedP2WPKH and NestedP2WSH
inputs. The scriptSig data push is now accounted for in a proper size
constant, and the input count is now incremented in both. This would
only be detectable in the event that the number of non-nested inputs and
the total number of inputs straddle the discontinuities in the
CompactSize encoding, e.g. 253, 2^16-1, or 2^32-1.
2020-03-04 08:00:33 -08:00
Conner Fromknecht
be74d94c48
lnwallet/size_test: add test exercising nested input count bug
This commit modifies the NP2WKH and NP2WSH input tests to ensure the
input count is properly incremented and accounted for in the size
estimate. 253 is chosen because it is the lowest value that, when
serialized, occupies more than one byte on the wire.
2020-03-04 08:00:09 -08:00
Johan T. Halseth
42e65d4ae5
Merge pull request #4030 from halseth/route-cutoff-flake-fix
chancloser: unregister channel before db modification
2020-03-04 13:14:32 +01:00
Oliver Gugger
ab024b98ee
rpcserver+itest: remove channel from backup when abandoning it 2020-03-04 10:58:50 +01:00
Oliver Gugger
4e0c276154
rpcserver: don't skip pending channels in backup subscription
The synchronous call to get all channel backups also include
channels that are pending at the moment of the call. A previous
commit added pending channels to the file based backup as well. So
this is the last backup method that needs to be adjusted to also
contain unconfirmed channels.
2020-03-04 10:58:49 +01:00