Commit Graph

8235 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
0e13c5ac3f
lnwallet+funding: expose new ValidateChannel method for 1st party validation
In this commit, we use the recently added `chanvalidate` package to
verify channels once they have been confirmed in the funding manager. We
expose a new method on the `LightningWallet` struct: `ValidateChannels`
which calls the new shared 1st party verification code.

After the channel is fully confirmed in the funding manager, we'll now
use this newly exposed method to handle all validation. As a result, we
can remove the existing validation code in the funding manager, and rely
on the new code in isolation.
2019-10-03 16:23:23 -07:00
Olaoluwa Osuntokun
6ebada112f
routing: update 3d party channel verification to use new chanvalidate package
In the process of moving to use the new package, we no longer need to
fetch the outpoint directly, and instead only need to pass the funding
transaction into the new verification logic.
2019-10-03 16:23:17 -07:00
Olaoluwa Osuntokun
c199ad30ac
lnwallet/chanvalidate: create new channel validation package
In this commit, we create a new `chanvalidate` package which it to house
all logic required for 1st and 3rd party channel verification. 1st party
verification occurs when we find a channel in the chain that is
allegedly ours, while 3rd party verification will occur when a peer
sends us a channel proof of a new channel.

In the scope of the recent CVE, we actually fully verified 3rd party
channels, but failed to also include those checks in our 1st party
verification code. In order to unify this logic, and prevent future
issues, in this PR we move to concentrate all validation logic into a
single function. Both 1st and 3rd party validation will then use this
function. Additionally, having all the logic in a single place makes it
easier to audit, and also write tests against.
2019-10-03 16:23:14 -07:00
Olaoluwa Osuntokun
1e67040145
lnwallet: copy commitment transaction in getSignedCommitTx
In this commit, we move to make a full deep copy of the commitment
transaction in `getSignedCommitTx` to ensure that we don't mutate the
commitment on disk, possibly resulting in a "hot commitment".
2019-10-03 16:23:10 -07:00
Conner Fromknecht
acc5104f53
lnrpc+routerrpc: disable custom tlv records via rpc
In order to prevent future unforeseen issues, we are temporarily
disabling the ability to send custom tlv records to the receiver of a
payment. Currently the receiver does not process or expose these
additional fields via rpc or internally, so they are being disabled
until the end-to-end flow is finished and fully validated.
2019-10-03 15:55:45 -07:00
tyzbit
be989a85ff lncli: start_time defaults to 24 hours ago
Here we set start_time to 24 hours prior
if it's not provided on the CLI.  The
effect of this is when you don't provide
a start_time:

CLI: -24h
RPC: Unix Epoch
2019-10-03 18:12:39 -04:00
tyzbit
8891346cb2 rpcserver: startTime defaults to the unix epoch
Fixes https://github.com/lightningnetwork/lnd/issues/3357.  When
start_time isn't specified, its default value is 0.  This meant when
users explicitly specified a start_time of 0, we would incorrectly set
start_time to 24 hours in the past.  Now, n0 means n0.
2019-10-03 18:12:21 -04:00
Wilmer Paulino
5ed1084130
Merge pull request #3572 from joostjager/canceled-spelling
multi: fix canceled spelling
2019-10-03 16:50:06 -04:00
Olaoluwa Osuntokun
450e5a7df4
Merge pull request #3568 from cfromknecht/correct-static-remote-key-feature-bits
lnwire/features: static_remote_key bits, 10/11 -> 12/13
2019-10-03 12:14:40 -07:00
Wilmer Paulino
e51df8d810
chainntnfs: only log confirmation notification registration once 2019-10-03 14:05:28 -04:00
Wilmer Paulino
40d63d5b4e
Merge pull request #3571 from joostjager/log-pathfinding-metrics
routing: log performance metrics
2019-10-03 12:21:45 -04:00
Joost Jager
b58dbb2d70
multi: fix canceled spelling 2019-10-03 17:27:36 +02:00
Joost Jager
9f3656efeb
routing: log performance metrics 2019-10-03 15:07:11 +02:00
Joost Jager
536dd47ce9
htlcswitch: log in lower case 2019-10-03 10:22:07 +02:00
Joost Jager
654b3cc718
htlcswitch: use prefix logger for remaining log statements in link 2019-10-03 10:22:05 +02:00
Joost Jager
03ed1b0aa3
htlcswitch: use prefix logger in link 2019-10-03 10:22:03 +02:00
Joost Jager
57562d6c4d
lnwallet: create channel specific log methods 2019-10-03 10:22:01 +02:00
Joost Jager
c4107ebbad
build: add prefixed logger 2019-10-03 10:21:59 +02:00
Johan T. Halseth
989de44a69
Merge pull request #3563 from joostjager/link-test-context
htlcswitch/test: create link test context
2019-10-03 09:45:36 +02:00
Olaoluwa Osuntokun
113c4346b0
Merge pull request #3562 from cfromknecht/perm-peer-fixes
server: don't prune manual perm connections
2019-10-02 20:46:47 -07:00
Wilmer Paulino
4b857f819a
Merge pull request #3567 from cfromknecht/bump-bitcoind-0.18.1
build: bump to bitcoind 0.18.1 for itests
2019-10-02 10:29:36 -04:00
Conner Fromknecht
65a991999d
lnwire/features: static_remote_key bits, 10/11 -> 12/13
Final version of spec allocated 12/13 to option_static_remote_key.
2019-10-02 03:33:22 -07:00
Conner Fromknecht
9710134f70
Merge pull request #3566 from wpaulino/wait-until-peer-active
peer+server: wait until peer is active to begin channel opening process
2019-10-01 17:36:32 -07:00
Conner Fromknecht
45114cb819
build: bump to bitcoind 0.18.1 for itests 2019-10-01 16:29:55 -07:00
Conner Fromknecht
1b79414175
server: don't prune manual perm connections 2019-10-01 16:13:35 -07:00
Wilmer Paulino
cf5dc90d04
peer+server: wait until peer is active to begin channel opening process
Without waiting, we would proceed to retrieve the remote peer's
supported features, which may have not been set due to not yet receiving
their Init message.
2019-10-01 17:42:43 -04:00
Johan T. Halseth
43b02d3035
Merge pull request #3481 from legacycode/fix-dockerfile
Fixed dockerfile by adding version numbers to base containers
2019-10-01 15:02:07 +02:00
Conner Fromknecht
10d53e61aa
Merge pull request #3551 from joostjager/safe-invoice-migration
channeldb: safe invoice migration
2019-09-30 15:48:19 -07:00
Christian Lehmann
d9e0f6c220
Fixed dockerfile by adding version numbers to base containers 2019-09-30 17:48:28 +02:00
Johan T. Halseth
f8621fe6d7
Merge pull request #3554 from alrs/stdlib-context
Use stdlib "context" Package
2019-09-30 10:15:34 +02:00
Lars Lehtonen
a22adc4a8e
macaroons: stdlib context 2019-09-28 16:10:57 -07:00
Lars Lehtonen
259b5b253d
lnd: stdlib context 2019-09-28 16:07:37 -07:00
Lars Lehtonen
8194d260ff
lnrpc: stdlib context 2019-09-28 16:06:34 -07:00
Lars Lehtonen
fa26359dd6
rpcserver: stdlib context 2019-09-28 15:46:21 -07:00
Lars Lehtonen
bd2e4d6c42
walletunlocker: stdlib context 2019-09-28 15:45:41 -07:00
Lars Lehtonen
dade977d7b
cmd: stdlib context 2019-09-28 15:44:45 -07:00
Lars Lehtonen
085a63fee5
lntest: stdlib context 2019-09-28 15:43:42 -07:00
Joost Jager
ac7c93f544
channeldb: fail migration for accepted hodl invoices 2019-09-28 08:30:33 +02:00
Joost Jager
31f72f6c7d
channeldb: extract before migration func 2019-09-28 08:30:31 +02:00
Joost Jager
f47de09850
channeldb: log error for migration test failures 2019-09-28 08:23:49 +02:00
Joost Jager
426ee28895
htlcswitch/test: move test functions into context 2019-09-26 15:11:23 +02:00
Joost Jager
23617bb9fd
htlcswitch/test: move test code 2019-09-26 15:11:21 +02:00
Johan T. Halseth
7fcac54dff
Merge pull request #3531 from LightningPeach/fix-tx-subscr
Add BlockHeight param to SubscribeTransactions when tx is confirmed
2019-09-26 09:26:25 +02:00
Olaoluwa Osuntokun
1ea2aecd3c
build: bump version to v0.8.0-beta 2019-09-25 19:19:08 -07:00
Olaoluwa Osuntokun
e84fe8f947
Merge pull request #3358 from halseth/mainnet-neutrino
config: allow mainnet neutrino
2019-09-25 19:15:48 -07:00
Olaoluwa Osuntokun
b1b4aab779
Merge pull request #3365 from Roasbeef/safu-commitments
multi: implement new safu commitment format
2019-09-25 19:13:56 -07:00
Olaoluwa Osuntokun
c6ee42d3e2
chanbackup: create new Single version for tweakless commitment chans
In this commit, we create a new Single version for channels that use the
tweakless commitment scheme. When recovering from an SCB into an open
channel shell, we'll now check this field and use it to determine the
proper channel type. Otherwise, we may attempt to sweep the on chain
funds using the commitment point, when it goes directly to our key, or
the other way around.
2019-09-25 18:26:20 -07:00
Olaoluwa Osuntokun
6d97bcbacd
lnwallet+contractcourt: publicly export DeriveCommitmentKeys use in chain watcher
In this commit, we consolidate the number of areas where we derive our
commitment keys. Before this commit, the `isOurCommitment` function in
the chain watcher used a custom routine to derive the expected
scripts/keys for our commitment at that height. With the recent changes,
we now have additional logic in `DeriveCommitmentKeys` that wasn't
copied over to this area. As a result, the prior logic would erroneously
detect if it was our commitment that had hit the chain or not.

In this commit, we remove the old custom code, and use
`DeriveCommitmentKeys` wihtin the chain watcher as well. This ensures
that we only need to maintain the key derivation code in a single place,
preventing future bugs of this nature.
2019-09-25 18:26:13 -07:00
Olaoluwa Osuntokun
e497a07d64
lntest/itest: extend basic funding test to cover all tweakless commitment cases 2019-09-25 18:26:10 -07:00
Olaoluwa Osuntokun
8ce76fff51
lnrpc: add new StaticRemoteKey field to ListChannels output 2019-09-25 18:26:07 -07:00