Commit graph

410 commits

Author SHA1 Message Date
Antoine Riard
0029f04fce Logging interface
Implement error, warn, info, debug and trace macros, internally calling
an instance of Logger, and passing it to every main structures
Build-time or client-side filtering.
Issue #54
2018-08-17 00:01:15 +00:00
Matt Corallo
587f2b39fc
Merge pull request #107 from ariard/event_handle_error
Implement HandleError event with ErrorAction field
2018-08-16 16:26:00 -04:00
Antoine Riard
e752611247 Implement HandleError event with ErrorAction field 2018-08-12 00:36:48 +00:00
Matt Corallo
b9d1024951
Merge pull request #108 from TheBlueMatt/2018-08-fuzz-fixes
Asorted Fixes from full_stack_target work
2018-08-05 23:04:18 -04:00
Matt Corallo
c52825d5f1 Fix UpdateAddHTLC serialize vec capacity default 2018-08-02 22:37:28 -04:00
Matt Corallo
3db5798246 Stub out ChaCha20 non-HMAC encryption/decryption in fuzztarget 2018-08-02 22:37:28 -04:00
Matt Corallo
482648bbf0 Fix fuzztarget insert_combine hash-collision panic 2018-08-02 22:26:44 -04:00
Matt Corallo
a6161210e2 Fix panic on reorg through the funding_locked-generating block
We had a TODO to handle "lost confirmation" in block_connected,
which we recently did in block_disconnected (calling force_shutdown
in case we get too many blocks disconnected) but didn't handle the
case where we had a simple reorg through the block that resulted in
us generating a funding_locked.
2018-08-02 22:26:44 -04:00
Matt Corallo
bd01f4e0c3 Fix fuzztarget ChannelKeys generation 2018-08-02 22:26:44 -04:00
Matt Corallo
2470812077 Fix types in Channel::funding_tx_confirmed_in
This should have no effect in a real system but was causing the
full_stack_target fuzz test to fail due to a block with a null hash
being disconnected.
2018-08-02 22:26:44 -04:00
Matt Corallo
cfc3fe3148 Fix panic!() in block_connected on unfunded channels (fixes #42)
The new full_stack_target fuzzing stuff was able to find this bug,
which gives me a bit of hope for full_stack_target's utility.
2018-08-02 22:26:44 -04:00
Matt Corallo
830343f129
Merge pull request #100 from TheBlueMatt/2018-07-htlc-balance-calc
Fix non-HTLC-inclusion balance calculation (mark II)
2018-07-31 00:59:31 -04:00
Matt Corallo
f975639d03
Merge pull request #102 from savil/hex-version
change hex version to 0.3, and leave out the minor bumps
2018-07-30 21:50:19 -04:00
Savil Srivastava
07d7b395e6 change hex version to 0.3, and leave out the minor bumps 2018-07-30 17:01:57 -07:00
Matt Corallo
b17211ffe4 Fix non-HTLC-inclusion balance calculation (mark II) 2018-07-30 18:29:03 -04:00
Matt Corallo
6919cd34f7
Merge pull request #98 from TheBlueMatt/2018-07-invalid-funding
Handle invalid funding tx in channelmanager
2018-07-29 14:25:18 -04:00
Matt Corallo
cf6532e3e6
Merge pull request #97 from TheBlueMatt/2018-07-no-useless-preimages
Stop adding remote's payment_preimages to our channel monitor
2018-07-29 14:01:14 -04:00
Matt Corallo
e571c7ac40
Merge pull request #96 from TheBlueMatt/2018-07-force-close-handling
Add pending-HTLC-failure to and unify force_shutdown() handling
2018-07-29 13:39:17 -04:00
Matt Corallo
7e255b5cf5 Handle invalid funding tx in channelmanager 2018-07-29 13:30:04 -04:00
Matt Corallo
1051e53ecc Stop adding remote's payment_preimages to our channel monitor 2018-07-29 13:30:04 -04:00
Matt Corallo
b22519c0f9 Some match -> if let replacement 2018-07-29 13:30:04 -04:00
Matt Corallo
fb9f169279 Assert usize is 32 or 64 bits, as required in a TODO 2018-07-29 13:30:04 -04:00
Matt Corallo
d5e316f5a0 Remove some excess mut's 1.22 complains about 2018-07-29 13:30:04 -04:00
Matt Corallo
c7c8a123ba Add pending-HTLC-failure to and unify force_shutdown() handling
This patch got a bit bigger than I'd intended, but primarily this
unifies force_shutdown() handling so all the callsites at least
look similar. It also fails backwards any HTLCs which were
completely pending (ie hadn't been committed to) and ensures we
broadcast our local commitment transaction. It also adds a
force_close_channel method to ChannelManager to expose
force-closure.
2018-07-29 02:23:02 -04:00
Matt Corallo
c26967348d Remove some useless Vecs 2018-07-29 02:23:02 -04:00
Matt Corallo
5c32e3cb91 Clean up forward_/claimable_htlcs handling and document consistency 2018-07-28 18:36:24 -04:00
Matt Corallo
9aed28fbf0 Fix force_shutdown() bug where we lose knowledge of a preimage
In case we are in AwaitingRemoteRevoke and we go to claim an HTLC
(at which point we've already given up the money to the next hop in
the payment) we just write it to holding_cell_htlc_updates.
However, we should be ensuring we *also* write it to our
channel_monitor as we need to make sure we can still claim it after
a force_shutdown() or otherwise after hitting the chain.
2018-07-28 18:34:01 -04:00
Matt Corallo
982317a444
Merge pull request #95 from savil/rm-bitcoin-util-hexbytes
replace use of bitcoin::utils::misc::hex_bytes with hex::decode
2018-07-28 16:19:33 -04:00
Savil Srivastava
4c44b787f1 use hex::decode instead of extend_vec_from_hex 2018-07-28 10:09:29 -07:00
Savil Srivastava
ca6b44b8cc replace use of bitcoin::utils::misc::hex_bytes with hex::decode
as requested in #84 discussion
https://github.com/rust-bitcoin/rust-lightning/pull/84#discussion_r205508845
2018-07-27 18:19:00 -07:00
Matt Corallo
194367fc3d
Merge pull request #94 from TheBlueMatt/2018-07-duplicate_hash
Handle duplicate payment_hash send_payment()s
2018-07-27 12:24:14 -04:00
Matt Corallo
e0c75caa3a Handle duplicate payment_hash send_payment()s
We don't bother doing anything smart, we just return an Err in
case we have a pending outbound HTLC with the payment_hash provided
for the send.

This doesn't resolve the TODO as users can still send duplicative
payments that have the same payment_hash as was already sent,
though the docs are updated and hopefully users do so on their own.
2018-07-26 19:39:26 -04:00
Matt Corallo
c75d07fdd4
Merge pull request #93 from TheBlueMatt/2018-07-announce-bug
Properly calculate Channel::announce_publicly
2018-07-26 15:34:39 -04:00
Matt Corallo
78023d6fa1 Remove excess mut warned on in 1.22 2018-07-26 15:11:36 -04:00
Matt Corallo
da014797b0 Properly calculate Channel::announce_publicly
For some reason we were only setting "announce_publicly" when
Channel::new_from_req had announce_publicly set to true and the
open_channel message had the relevant flag set. However, this
resulted in us rejecting peers for sending unsolicited
announcement_signatures messages, despite them having indicated,
and us having accepted, their announce-bit-set open_channel.
2018-07-26 15:11:36 -04:00
Matt Corallo
731aeab1f8
Merge pull request #90 from TheBlueMatt/2018-07-percent-bump
Bump README percent usable
2018-07-26 12:48:28 -04:00
Matt Corallo
7f4602596c Fix some tab-space errors in #84 2018-07-26 11:57:43 -04:00
Matt Corallo
8ec816e72a ACHIEVEMENT UNLOCKED 2018-07-26 11:57:40 -04:00
Matt Corallo
fe9bb1d970
Merge pull request #84 from savil/sort_outputs
[RFC][Tx Sort] Implement sorting of inputs
2018-07-26 11:54:17 -04:00
Matt Corallo
27d655fde1
Merge pull request #92 from savil/editorconfig-fix
fix editorconfig so it applies to every file
2018-07-25 23:46:40 -04:00
Savil Srivastava
da09c4d7f3 adding BIP69 test-cases 2018-07-25 18:33:03 -07:00
Savil Srivastava
2f9f0f1c63 fix editorconfig so it applies to every file 2018-07-25 18:14:06 -07:00
Matt Corallo
fb4be8a163
Merge pull request #89 from TheBlueMatt/2018-07-route-fuzz-fix-1
Fix fee addition overflow in get_route
2018-07-25 18:44:41 -04:00
Matt Corallo
158d0c16dc Fix fee addition overflow in get_route 2018-07-25 18:10:46 -04:00
Matt Corallo
a331849005
Merge pull request #87 from savil/editorconfig
add .editorconfig to ensure we use tabs, not spaces
2018-07-25 18:08:38 -04:00
Matt Corallo
62543a60e1
Merge pull request #88 from TheBlueMatt/2018-07-new-fuzzing
Add Router Fuzz Target
2018-07-25 17:03:24 -04:00
Matt Corallo
c45d8eb41e Only abort channel_target fuzz test on Err if ErrorAction says to 2018-07-25 16:25:12 -04:00
Matt Corallo
0ce6e397a7 Add router_target to fuzzing which fuzzes router msgs + get_route 2018-07-25 16:25:12 -04:00
Matt Corallo
07f08409f8 Catch fee overflow panic in get_route 2018-07-25 16:25:12 -04:00
Matt Corallo
66023b7886 Update NodeAnnouncement addr deserialization to check addr len.
This more aggressively checks the message contents are correct
before returning WrongLength so existing fuzz setup has an easier
time.
2018-07-25 15:57:36 -04:00