Commit Graph

9020 Commits

Author SHA1 Message Date
Johan T. Halseth
44756b5811
cfg: rename legacyprotocol to protocol
Since we are also going to use it for experimental new features.
2020-03-09 12:59:34 +01:00
Johan T. Halseth
51c5352ae4
itest: make commit type enum
To prepare for adding more commit types to test for basic channel
funding, we make the commit type an enum that gets its own set of
subtests.
2020-03-09 12:59:34 +01:00
Johan T. Halseth
f95a82bf5f
lnwallet+funding: create CommitmentType enum 2020-03-09 12:59:34 +01:00
Johan T. Halseth
8741b93723
lnwallet/reservation: add non-initiator balance check
If we are the initiator, we check that our starting balance after
subtracting fees are not less than two times the default dust limit.

This commit adds a similar check for the non-initiator case, checking
that the remote party has a starting balance of reasonable size.
2020-03-09 12:59:34 +01:00
Johan T. Halseth
ad8e9f30c6
lnwallet+breacharbiter: record local csv delay 2020-03-09 12:59:34 +01:00
Johan T. Halseth
92af2342da
lnwallet+nursery+input: set sequence=1 for direct HTLC spends 2020-03-09 12:59:33 +01:00
Johan T. Halseth
c5d58b4762
lnwallet: set 2nd level sequence according to channel type 2020-03-09 12:59:33 +01:00
Johan T. Halseth
bddd3e128c
lnwallet: make second level sigs using sighash single|anyonecanpay 2020-03-09 12:59:33 +01:00
Johan T. Halseth
d1089fb449
input/test_utils: make mockSigner use SigHashType from sign descriptor 2020-03-09 12:59:33 +01:00
Johan T. Halseth
6810912c86
lnwallet: choose HTLC scripts based on channel type 2020-03-09 12:59:33 +01:00
Johan T. Halseth
21c5a957bc
lnwallet/channel: add feerate sanity check 2020-03-09 12:59:22 +01:00
Johan T. Halseth
ea94dbbe34
input+lnwallet: use individual commit weight calculations for channel type
Based on the channel type, the commitment weight will be calculated.
2020-03-09 12:10:59 +01:00
Johan T. Halseth
1f28bd8086
contractcourt/commit_sweep_resolver: set sweep witness type based on witness script
We use the fact that we can tell whether the commit is local or remote
by inspecting the witness script. We cannot use the maturity delay
anymore, as we can have delayed to_remote outputs also now.

Co-authored-by: Joost Jager <joost.jager@gmail.com>
2020-03-09 12:10:59 +01:00
Johan T. Halseth
af68ff1640
lnwallet: add anchor commitmenttype
With this commitment type, we'll add extra anchor outputs to the
commitment transaction if the anchor channel type is active.
2020-03-09 12:10:59 +01:00
Johan T. Halseth
50199aeaf3
input/script_utils: add anchor scripts + tests 2020-03-09 12:10:59 +01:00
Johan T. Halseth
6deb913a8d
input: add CommitmentToRemoteConfirmed witness type 2020-03-09 12:10:59 +01:00
Johan T. Halseth
990992ce94
input/script_utils: add delayed to_remote script + tests 2020-03-09 12:10:59 +01:00
Johan T. Halseth
a309132253
input/script_utils test: add test cases for delayed HTLC receiver scrpts 2020-03-09 12:10:59 +01:00
Johan T. Halseth
dc271a80cb
input/script_utils test: add test cases for delayed HTLC sender script 2020-03-09 12:10:58 +01:00
Johan T. Halseth
8c0deb81c2
input+lnwallet: Add scripts for CSV delayed HTLC outputs
We also increase the witness size for these types to account for the 3
extra bytes. The size won't be correct in all cases, but it is just an
upper bound in any case.
2020-03-09 12:10:58 +01:00
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
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
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
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