Commit Graph

274 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
e0adb0a4dd
Merge pull request #1007 from wpaulino/htlc-switch-stats
htlcswitch: fix periodic calculation of satoshis sent/received
2018-04-05 20:44:27 -07:00
Olaoluwa Osuntokun
ca9174e166
peer: extend SendMessage to allow callers to block until msg is sent 2018-04-04 17:43:57 -07:00
Olaoluwa Osuntokun
b3bc374ba1
htlcswitch: send a direct Error if we get a known channel error on validate commit 2018-04-04 17:41:47 -07:00
Olaoluwa Osuntokun
0dbd325fd0
htlcswitch: synchronously send the error to the peer on commitment verify fail
In this commit, we fix a slight bug in lnd. Before this commit, we would
send the error to the remote peer, but in an async manner. As a result,
it was possible for the connections to be closed _before_ the error
actually reached the remote party. The fix is simple: wait for the error
to be returned when sending the message. This ensures that the error
reaches the remote party before we kill the connection.
2018-04-04 17:38:35 -07:00
Olaoluwa Osuntokun
f53a99e18e
htlcswitch: modify the SendMessage method on the Peer interface to optionally block
In this commit, add a new argument to the SendMessage method to allow
callers to request that the method block until the message has been sent
on the socket to the remote peer.
2018-04-04 17:36:44 -07:00
Wilmer Paulino
fca0df28e9
htlcswitch: fix periodic calculation of satoshis sent/received
In this commit, we fix an issue where users would be displayed negative
amounts of satoshis either as sent or received. This can happen if the
total amount of channel updates decreases due to channels being closed.

To fix this, we properly handle a negative difference of channel
updates by updating the stats logged to only include active
channels/links to the switch.
2018-04-02 21:23:55 -04:00
Olaoluwa Osuntokun
5984cbd4ff
htlcswitch: allow overpaying for incoming payments
In this commit, we relax the constraints on accepting an exit hop
payment a bit. We'll now accept any incoming payment that _at least_
pays the invoice amount. This puts us further inline with the
specification, which recommends that nodes accept overpayment by a
certain margin.

Fixes #1002.
2018-04-02 15:58:56 -07:00
Alex Bosworth
1614fe0fa6 htlcswitch: trivial whitespace
Missing space results in `unable to get channel links: unable to locate channel link bydestination hop id` log messages
2018-03-28 15:16:06 -07:00
Olaoluwa Osuntokun
0fb7804e4a
Merge pull request #826 from cfromknecht/reextract-circuit-encrypters
Reextract Circuit Error Encrypters
2018-03-13 18:10:12 -07:00
Conner Fromknecht
f1e407cecc
htlcswitch/test_utils: DecodeOnionObfuscator - ExtractErrorEncrypter 2018-03-13 16:33:29 -07:00
Conner Fromknecht
c762fe0caa
htlcswitch/switch: pass ExtractErrorEncrypter to circuitMap 2018-03-13 16:33:29 -07:00
Conner Fromknecht
cee221f8cc
htlcswitch/mock: add Reextract NOP to mockObfuscator 2018-03-13 16:33:28 -07:00
Conner Fromknecht
2fbb0c8b92
htlcswitch/link_test: DecodeOnionObfuscator -> ExtractErrorEncrypter 2018-03-13 16:33:28 -07:00
Conner Fromknecht
d13a566284
htlcswitch/link: DecodeOnionObfuscator -> ExtractErrorEncrypter 2018-03-13 16:33:28 -07:00
Conner Fromknecht
3d487e3ca3
htlcswitch/iterator: extract error encrypter from ephemeral key 2018-03-13 16:33:28 -07:00
Conner Fromknecht
dccab0a654
htlcswitch/failure: add Reextract to SphinxErrorEncrypter 2018-03-13 16:33:28 -07:00
Conner Fromknecht
75c7349823
htlcswitch/circuit_test: use circuit map config and test rextraction 2018-03-13 16:33:28 -07:00
Conner Fromknecht
64ee4e0247
htlcswitch/circuit_map: add Config and Reextract obfuscators 2018-03-13 16:33:27 -07:00
Johan T. Halseth
b2608dd292
htlcswitch/link_test: increase timeout for message sends
This commit increases the time we wait for a message to be sent for
several test cases, aiming to decrease the false negative rate on
Travis.
2018-03-13 12:20:58 +01:00
Olaoluwa Osuntokun
45eaa70814
Merge pull request #821 from cfromknecht/switch-early-shutdown
htlcswitch/switch: improve safety of switch shutdown
2018-03-12 19:57:19 -07:00
Olaoluwa Osuntokun
8988a07bce
htlcswitch: eliminate unnecessary indentation in processRemoteAdds
In this commit, we remove a ton of unnecessary indentation in the
processRemoteAdds method. Before this commit, we had a switch statement
on the type of the entry. This was required before when the method was
generic, but now since we already know that it’s an Add, we no longer
require such a statement.
2018-03-12 18:58:46 -07:00
Olaoluwa Osuntokun
069311c47f
htlcswitch: log dangling circuits in unable to create new commitment 2018-03-12 18:58:45 -07:00
Olaoluwa Osuntokun
bdd01cccb2
htlcswitch: remove getBandwidthCmd as it's no longer needed 2018-03-12 18:58:45 -07:00
Olaoluwa Osuntokun
1af8fa9367
htlcswitch: add additional comments and logging 2018-03-12 18:58:44 -07:00
Olaoluwa Osuntokun
c285bb5814 htlcswitch+peer: remove DecodeHopIterator from ChannelLinkConfig
In this commit, we remove the DecodeHopIterator method from the
ChannelLinkConfig struct. We do this as we no longer use this method,
since we only ever use the DecodeHopIterators method now.
2018-03-12 18:58:08 -07:00
Olaoluwa Osuntokun
f2b676e93c
Merge pull request #790 from halseth/wire-error-handoff
Wire error handoff
2018-03-12 18:56:35 -07:00
Conner Fromknecht
914c59eb30
htlcswitch/switch: ensures safe shutdown of switch 2018-03-12 16:40:16 -07:00
Conner Fromknecht
5df8b52dae
multi: set initiator funding txn 2018-03-11 15:06:22 -07:00
Johan T. Halseth
33762e0f81
htlcswitch/link: fail channel on lnwire.Error 2018-03-11 17:21:23 +01:00
Olaoluwa Osuntokun
7ea9e7cf4c
htlcswitch: fix linter warning 2018-03-10 19:09:18 -08:00
Olaoluwa Osuntokun
800eea931f
build+multi: switch from bolt to bbolt
In this commit, we switch from boltbd/bolt to coreos/bbolt as the
former is no longer being actively maintained.
2018-03-10 19:01:13 -08:00
Conner Fromknecht
02489dc6c0
htlcswitch/test_utils: instantiate config with batch onoin processing 2018-03-09 21:08:44 -08:00
Conner Fromknecht
4f68d1beca
htlcswitch/switch_test: change forward() -> send() 2018-03-09 21:08:44 -08:00
Conner Fromknecht
1b7afc6da5
htlcswitch/mock: add mock fwding log to initSwitchWithDB 2018-03-09 21:08:44 -08:00
Conner Fromknecht
5fd1206da6
htlcswitch/switch: modifies forward method to support async invocation 2018-03-09 21:08:44 -08:00
Conner Fromknecht
fbb8f0bcce
htlcswitch/sequencer: adds a persistent emitter of payment IDs 2018-03-09 21:08:44 -08:00
Conner Fromknecht
e4fb420665
htlcswitch/packet: adds serialization to htlcPacket 2018-03-09 21:08:44 -08:00
Conner Fromknecht
3048dfd4be
htlcswitch/mock: adds Encode/Decode to mock obfuscator 2018-03-09 21:08:43 -08:00
Conner Fromknecht
3ae7772ecb
htlcswitch/mailbox_test: adds checks for reset and replay of pkts 2018-03-09 21:08:43 -08:00
Conner Fromknecht
9b00f83656
htlcswitch/mailbox: makes pkts replayable via Reset 2018-03-09 21:08:43 -08:00
Conner Fromknecht
3a186a02a9
htlcswitch/link_test: generate random preimages 2018-03-09 21:08:43 -08:00
Conner Fromknecht
101ad09e9f
htlcswitch/link: batches processing of locked in htlcs 2018-03-09 21:08:43 -08:00
Conner Fromknecht
2c3d35bb40
htlcswitch/interfaces: have HandleSwitchPacket return an error 2018-03-09 21:08:43 -08:00
Conner Fromknecht
403028da78
htlcswitch/circuit_test: use half adds in circuit map test 2018-03-09 21:08:42 -08:00
Conner Fromknecht
0b71f74199
htlcswitch/circuit_map: moves circuit map impl to own file 2018-03-09 21:08:42 -08:00
Conner Fromknecht
067b261602
htlcswitch/circuit: add half adds to circuit map 2018-03-09 21:08:42 -08:00
Conner Fromknecht
02c65db0d1
htlcswitch/link_test: integrate new channel update APIs 2018-03-09 17:35:54 -08:00
Conner Fromknecht
1fe7c6d431
htlcswitch/link: integrate persistence changes to lnwallet APIs 2018-03-09 17:35:53 -08:00
Conner Fromknecht
6a88ff940a
htlcswitch_/test_utils: init OpenChannels w/ Packager 2018-03-09 14:45:31 -08:00
Olaoluwa Osuntokun
51a3cab39c
htlcswitch: fix race in forwarding log test by grabbing log mtx 2018-03-08 20:11:49 -08:00