Commit Graph

14 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
8a51b1a0c6
Htlcswitch: switch all accounting and forwarding decisions to use mSAT's 2017-08-22 00:53:04 -07:00
Olaoluwa Osuntokun
0d4ee08372
htlcswitch: asynchronously handle channel close requests
This commit modifies how the htlcswitch handles close requests.
Previously it could be the case that a new channel was added, but at
the same time a channel was requested to be closed. This would result
in a circular waiting dependency: the peer contacts the switch, who
tries to contact the peer.

We eliminate this possibility by ensuring that the switch handles all
close requests asynchronously. With this, the switch won't block
indefinitely in the scenario described above.
2017-08-03 16:59:16 -07:00
Steven Roose
09719626e5 htlcswitch: Fix typo in logging
Because the .String() method of an amount already includes a unit string
("BTC" usually), it was printing "0.00000001 BTC satoshi".
2017-07-31 21:45:15 -07:00
Olaoluwa Osuntokun
402112e6ee
htlcswitch: update tests utilities to be aware of new commitment design 2017-07-30 17:51:20 -07:00
Olaoluwa Osuntokun
a04fa76a4c
lnwire+htlcswitch: minor grammatical, formatting fixes after error PR 2017-07-14 20:08:37 -07:00
Andrey Samokhvalov
79b8d26b1a htlcswitch+router+server: handle payment error topology updates
In previous commits we have intoduced the onion errors. Some of this
errors include lnwire.ChannelUpdate message. In order to change
topology accordingly to the received error, from nodes where failure
have occured, we have to propogate the update to the router subsystem.
2017-07-14 19:08:04 -07:00
Andrey Samokhvalov
2d378b3280 htlcswitch+router: add onion error obfuscation
Within the network, it's important that when an HTLC forwarding failure
occurs, the recipient is notified in a timely manner in order to ensure
that errors are graceful and not unknown. For that reason with
accordance to BOLT №4 onion failure obfuscation have been added.
2017-07-14 19:08:04 -07:00
Olaoluwa Osuntokun
01d54c29af
htlcswitch: restore the ability to properly handle debughtlc recv's
This commit fixes a regression introduce in the prior commit which
added full verification of the per-hop payloads to the ChannelLink
interface. When this was initially implemented, the added checks
weren’t guarded on the existence of debughtlc’s. As a result,
debughtlc’s would be rejected as they don’t match the expected invoice
value.

This commit fixes that issue by only checking the hop payload if debug
HTLC mode isn’t on.
2017-07-04 15:58:23 -07:00
Olaoluwa Osuntokun
0fc62f123d
htlcswitch: log regular channel ID when registering channels 2017-06-19 16:39:45 +02:00
Olaoluwa Osuntokun
4b0e331c62
htlcswitch: fix linter issues 2017-06-17 01:04:21 +02:00
Olaoluwa Osuntokun
1f5a4fcb8e
htlcswitch: change over all internal indexes to use short channel ID's 2017-06-16 23:49:46 +02:00
Olaoluwa Osuntokun
74897dc328
htlcswitch: fix linter error 2017-05-31 16:48:12 -07:00
Olaoluwa Osuntokun
048e4c0a39
htlcswitch: fix issues with forwarding stats logger display
This commit fixes some issues in the display of the stats logger which
resulted in: stats being printed even though no forwarding activity
took place, and underflow of integers resulting in weird outputs when
forwarding.

This commit also adds some additional comments and renames the main
forwarding goroutine to its former name.
2017-05-31 16:16:58 -07:00
Andrey Samokhvalov
b86409cdb3 htlcswitch: recreate hlcswitch from scratch
This commit gives the start for making the htlc manager and htlc switch
testable. The testability of htlc switch have been achieved by mocking
all external subsystems. The concrete list of updates:

1. create standalone package for htlc switch.
2. add "ChannelLink" interface, which represent the previous htlc link.
3. add "Peer" interface, which represent the remote node inside our
subsystem.
4. add htlc switch config to htlc switch susbystem, which stores the
handlers which are not elongs to any of the above interfaces.

With this commit we are able test htlc switch even without having
the concrete implementation of Peer, ChannelLink structures, they will
be added later.
2017-05-31 11:06:08 -07:00