Commit Graph

8999 Commits

Author SHA1 Message Date
Carla Kirk-Cohen
1a3f5f2d6e
Merge pull request #3844 from carlaKC/htlcnotifier-1-detailedswitcherrors
invoiceregistry+htlcswitch: Introduce resolution types and add link errors
2020-02-11 09:13:53 +02:00
Carla Kirk-Cohen
4040731f70
Merge pull request #3984 from carlaKC/channeldb-fetchchannels
channeldb: Replace fetchChannels pending/waiting bools with optional filters
2020-02-11 08:40:54 +02:00
Joost Jager
a8ed1b342a
routing: remove pathfinding db tx
Pathfinding is never used with an externally supplied bbolt transaction.
2020-02-10 19:55:40 +01:00
Joost Jager
88eae6eafe
lnwallet: fix invalid value use in restoreUpdate
Updates were always restored with the same log index. This could cause a
crash when the logs were compacted and possibly other problems
elsewhere.

Extended unit test to cover the crash scenario.
2020-02-10 13:56:33 +01:00
Yaacov Akiba Slama
90008386d8 Copy InputIndex into the underlying SignDescriptor struct
When the InputIndex is not 0, the index is not currently copied into the
underlying SignDescriptor structure and the siganture generated is not
valid.
2020-02-09 10:55:50 +02:00
yancy
1528ef8b85 docker: add terminal symbol to docker readme example commands 2020-02-07 08:37:57 -06:00
carla
ed81c88239
channeldb: replace fetch channels booleans with optional filters
This changes replaces the pending an waiting booleans in fetchChannels
with optional filters which can be more flexibly used. This change
allows filtering of channels without having to reason about the matrix
of possible boolean combinations. A test is added to ensure that the
combinations of these filters act as expected.
2020-02-06 21:39:54 +02:00
carla
c5c2fc27f9
channeldb/test: replace test channel boilerplate createTestChannel
This change replaces test channel creation boilerplate with a
createTestChannel function which can be customized using functional
options.
2020-02-06 21:28:25 +02:00
carla
1ad395ec3f
htlcswitch: add failure details to incoming failures
This commit adds LinkErrors with failure details to htlcs which fail on
our incoming link. This change is made with the intention of notifying
detailed htlc failure reasons in sendHTLCError. The FailureDetail
interface is implemented on FailureResolutionResults so that they can
directly be used to enrich LinkErrors. sendHtlcError is updated to
take a LinkError in preparation for the addition of a htlcnotifier
which will notify the detail of the error.
2020-02-06 19:43:39 +02:00
carla
74e0d545fe
htlcswitch: add linkError field to htlcpacket
This commit adds a linkError field to track the value of failures
which occur at our node. This field is set when local payments or
multi hop htlcs fail in the switch or on our outgoing link. This
addition is required for the addition of a htlc notifier which will
notify these failures in handleDownstreamPacket.

The passing of link error to failAddPacket removes the need for an
additional error field, because the link error's failure detail will
contain any additional metadata. In the places where the failure detail
does not cover all the metadata that was previously supplied by addr
err, the error is logged before calling failAddPacket so that this
change does not reduce the amount of information we log.
2020-02-06 19:43:29 +02:00
carla
9390d3bbfd
htlcswitch: replace outgoing failure with interface
Add a FailureDetail interface which allows us have different kinds of
failures for link errors. This interface will be used to cover failures
that occur when on invoice payment, because the errors have already
been enumerated in the invoices package.
2020-02-06 19:43:23 +02:00
carla
bdd9411bbd
htlcswitch: rename FailureDetail to OutgoingFailure
Rename FailureDetail in a separate commit so that a FailureDetail
interface can be introduced in the following commit.
OutgoingFailureOnionDecode is renamed to OutgoingFailureDecodeError
to specifically indicate that we could not decode the wire
failure that our payment experienced.
2020-02-06 19:43:14 +02:00
carla
8cbed23f26
invoices: split resolution result into settle, fail and accept enums
This commit splits the resolution result enum into results divided
by outcome (settled, failed or accepted). This allows us to more
strictly control which resolution results can be used with which
HtlcResolution structs, to prevent the combination of a settle
resolution result with a failure resolution result, for example.
2020-02-06 19:41:39 +02:00
carla
2569b4d08a
multi: replace htlcResolution with an interface
This commit repalces the htlcResolution struct with an interface.
This interface is implemeted by failure, settle and accept resolution
structs. Only settles and fails are exported because the existing
code that handles htlc resolutions uses a nil resolution to indicate
that a htlc was accepted. The accept resolution is used internally
to report on the resolution result of the accepted htlc, but a nil
resolution is surfaced. Further refactoring of all the functions
that call NotifyExitHopHtlc to handle a htlc accept case (rather than
having a nil check) is required.
2020-02-06 19:41:36 +02:00
Olaoluwa Osuntokun
2cd26d7556
Merge pull request #3980 from joostjager/registry-deadlock
invoices: fix htlc timer deadlock
2020-02-04 17:14:17 -08:00
Joost Jager
0042a1ffeb
invoices: fix htlc timer deadlock 2020-02-04 15:22:08 +01:00
Joost Jager
51324ac7ae
invoices: move log into update context 2020-02-04 15:22:06 +01:00
Joost Jager
a339065fdc
invoices: add hash to update context 2020-02-04 15:22:04 +01:00
Johan T. Halseth
80c5232d4f
Merge pull request #3978 from bhandras/hotfix
invoices: fix log messages
2020-02-04 12:56:18 +01:00
Joost Jager
da6b33f0b9
Merge pull request #3979 from carlaKC/lnd-fixlinter
lnd: fix gosimple linter failure
2020-02-04 10:16:34 +01:00
carla
bbf3877d65
lnd: fix gosimple linter failure
GoSimple linter check fails for time.Now().Sub. Change the logged
database open time to use time.Since instead.
2020-02-04 10:06:45 +02:00
Olaoluwa Osuntokun
698f1175f8
lnd: add timing information to db open log 2020-02-03 16:19:01 -08:00
MrManPew
19bdbe7f8d Update channeldb opening log
It might take a few minutes and it should therefore state it...
2020-02-03 16:18:56 -08:00
Olaoluwa Osuntokun
e25cca11f7
Merge pull request #3915 from carlaKC/3771-loopattackprotection
htlcswitch: Disallow circular routes on same channel
2020-02-03 15:59:53 -08:00
Olaoluwa Osuntokun
07977a2bf0
Merge pull request #3957 from cfromknecht/amp-record
record+routing/route: add AMP record
2020-02-03 15:53:21 -08:00
Andras Banki-Horvath
e6561ca86d invoices: fix log messages
This commit fixes incorrect log messages.
2020-02-03 15:12:55 +01:00
Roei Erez
f8da26ee30 contractcourt: change shouldGoOnChain signature.
This commit changes the shouldGoOnChain signature to get the htlc
as parameter. I will allow the function to take decisions based on
whether the htlc is Incoming or Outgoing.
2020-02-03 12:46:21 +02:00
Olaoluwa Osuntokun
ab59f47a0b
Merge pull request #2593 from Crypt-iQ/brontide_fuzz_0119
fuzz: adding fuzz harnesses for acts 1-3, encryption+decryption
2020-01-31 17:16:30 -08:00
Johan T. Halseth
b39e21f6dd
Merge pull request #3926 from C-Otto/master
Fix typos
2020-01-31 11:34:34 +01:00
nsa
0d42da0cb3
fuzz/brontide: random+static round-trip encrypt+decrypt harnesses 2020-01-30 16:46:02 -05:00
nsa
0be5660a2a
fuzz/brontide: random+static encrypt harnesses 2020-01-30 16:46:02 -05:00
nsa
468e5c03e9
fuzz/brontide: random+static decrypt harnesses 2020-01-30 16:46:01 -05:00
nsa
116c5469bc
fuzz/brontide: random+static harnesses for acts 1-3 2020-01-30 16:46:01 -05:00
nsa
511fdb2520
fuzz/brontide: add fuzzing helper utilities 2020-01-30 16:46:01 -05:00
nsa
7c316b9194
brontide: add SetCurveToNil function 2020-01-30 16:45:59 -05:00
carla
afc7cc7f84
htlcswitch+config: make circular forwarding defence configurable
Add a bool to the switch's config which can be used to disable same
channel circular route checks.
2020-01-30 10:13:47 +02:00
carla
a3478f1d99
htlcswitch: add CheckCircularForward to handlePacketForward
Add a CheckCircularForward function which detects packets which are
forwards over the same incoming and outgoing link, and errors if the
node is configured to disallow forwards of this nature. This check is
added to increase the cost of a liquidity lockup attack, because it
increases the length of the route required to lock up an individual
node's bandwidth. Since nodes are currently limited to 20 hops,
increasing the length of the route needed to lock up capital increases
the number of malicious payments an attacker will have to route, which
increases the capital requirement of the attack overall.
2020-01-30 10:13:40 +02:00
carla
c08377d303
htlcswitch/test: replace mock server delta with constant 2020-01-30 10:02:44 +02:00
Wilmer Paulino
bed485f0a9
Merge pull request #3194 from halseth/listpayments-test-on-chain-settle
[integration tests]: restart Alice after on-chain settle
2020-01-28 17:29:23 -08:00
Conner Fromknecht
9fc197d8b1
routing/route: fix TestMPPHop comment 2020-01-28 06:43:44 -08:00
Conner Fromknecht
0cb27151e5
routing/route: add AMP record to payload size calcs 2020-01-28 06:43:34 -08:00
Conner Fromknecht
de88a4b174
record: add AMP record and encode/decode methods 2020-01-28 06:43:07 -08:00
Olaoluwa Osuntokun
04c3998f4b
Merge pull request #3965 from guggero/rest-api-falsey
rpcserver: instruct REST marshaler to emit default values
2020-01-27 12:19:57 -08:00
Oliver Gugger
c8b7108eeb
rpcserver: instruct REST marshaler to emit default values
This change instructs the REST proxy server to overwrite its default
JSON marshaler settings. That allows us to set EmitDefaults to true
which will result in all JSON fields returned in REST responses to
be fully populated, even if their values are falsey.
2020-01-27 15:40:39 +01:00
Johan T. Halseth
1dadce7cfd
Merge pull request #3945 from joostjager/node-level-penalty
routing: penalize node-level failures harder
2020-01-25 12:50:09 +01:00
Olaoluwa Osuntokun
e79897e651
Merge pull request #3950 from bhandras/invoice-expiry-startup-fix
invoices: fix slow startup with many expired invoices
2020-01-24 16:49:43 -08:00
Olaoluwa Osuntokun
767128e6c5
Merge pull request #3927 from guggero/lnwallet-scrypt
keychain+walletunlocker: use fast scrypt options for unit tests
2020-01-24 13:24:30 -08:00
Andras Banki-Horvath
fabcdf754a invoices: fix slow startup with many expired invoices
This commit intends to fix slow first startup time when there are many
invoices that need to be canceled. The slowdown is caused by a combination
of adding invoices to the expiry watcher one-by-one and slow
cancellation. Due to slow cancellation and the unbuffered channel which
we use to pass invoices to the expiry watcher blocks the registry.
With this fix we'll instead batch add invoices to the expiry watcher and
thereby won't block the registry startup.
2020-01-24 21:01:10 +01:00
Johan T. Halseth
a8ec8f2db6
Merge pull request #3582 from hsjoberg/pendingchannelevent
rpc: Add PendingOpenChannel to SubscribeChannelEvents
2020-01-24 14:42:40 +01:00
Oliver Gugger
3f45fb3781
walletunlocker: use fast scrypt options for unit tests 2020-01-24 14:02:40 +01:00