Commit Graph

9074 Commits

Author SHA1 Message Date
Johan T. Halseth
b25f2fa94b
channeldb: define AnchorOutputsBit channel type 2020-03-09 12:10:58 +01:00
Johan T. Halseth
6ecb379088
lnwallet: thread chanType down into genHtlcScript, gen[..]SigJobs,
create[..]Tx

NO FUNCTIONAL CHANGES
This is a commit just supplying the channel types to various methods.
2020-03-09 12:10:58 +01:00
Johan T. Halseth
b228681a02
input/script_utils_test: refactor TestHTLCSenderSpendValidation
To be able to change more than the witness used for each test case, we
extract commit and sweep tx generation into own methods that can be
called from each test case.

We do the same for TestHTLCReceiverSpendValidation
2020-03-09 12:10:58 +01:00
Johan T. Halseth
b56c7e308b
input/script_utils_test: extract script execution into assert method
This fixes an error case that wouldn't have been caught, since
vm.Execute applies more rules than the individual steps (most notably
the clean stack rule).

Instead we execute the engine as normal, and only step through if we
decide that the outcome is unexpected.
2020-03-09 12:10:58 +01:00
Johan T. Halseth
865776c776
lnwallet/channel: use genHtlcScript to create scripts
It takes into account the necessary variables and will prepare us for
doing commitment type dependent script generation later.
2020-03-09 12:10:57 +01:00
Johan T. Halseth
02dd8d23fd
input/size: remove unused constants
Since we never attempt to sweep an HTLC we offered with the preimage on
the remote's commitment, we never use the constant
AcceptedHtlcSuccessWitnessSize for weight estimation. Similarly, we
never timout an HTLC offered by the remote on our own commitment, and
don't need the constant OfferedHtlcTimeoutWitnessSize.
2020-03-09 12:10:57 +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
Oliver Gugger
8a2c02f8ea
itest: test unconfirmed channel backup file 2020-03-04 10:58:49 +01:00
Oliver Gugger
d8c62c37a8
channel_notifier: update backup on pending chan
To fix the discrepancy between getting the channel backups via
RPC where all pending channels are included, we also update the
channel.backup file on disk whenever we get a pending channel
event notification.
2020-03-04 10:58:49 +01:00
Johan T. Halseth
03a0706593
chancloser: unregister channel before db modification
This fixes a race during channel closing, where the last channel state
update was still not finished when we set the channel close bit in the
database. This lead to a flake during integration tests, where the last
state update would not finish, and the channel wasn't closes
successfully.

We fix it by first unregistering the channel, making sure it is removed
fully from the link before doing the db modification.
2020-03-04 10:31:38 +01:00
nsa
363bdc42b0
fuzz/lnwire: adding fuzz harnesses for all lnwire messages + zlib 2020-03-03 13:58:25 -05:00