Commit graph

4486 commits

Author SHA1 Message Date
Matt Corallo
1360fccd71 Ignore unknown channel flags as required in BOLT 2 2018-08-17 13:22:44 -04:00
Yuntai Kyong
69624a8556 add 1% chnnel reserve while keeping min value
if 1000 is always used it will almost always fail test reserve < dust_limit check
2018-08-17 13:18:29 -04:00
Yuntai Kyong
1c839ff103 Add checking locally derived reserve and dust limit 2018-08-17 13:18:28 -04:00
Yuntai Kyong
716b37863a document optional channel constraints per spec 2018-08-17 13:18:28 -04:00
Yuntai Kyong
0fece38b19 Add various checking when handling open and accept
Add `derive_minimum_depth()` and `derive_maximum_minimum_depth()` and hide
CONF_TARGET constant behind these functions.

Replace `DisconnectPeer` error with `HandleError` with `ErrorAction::SendErrorMessage`
2018-08-17 13:18:28 -04:00
Yuntai Kyong
ada2154b40 Add push_msat to new outbound API
Also add APIMisuseError to be thrown to the API client
2018-08-17 13:18:28 -04:00
Yuntai Kyong
4553369d20 Add APIError enum
`APIMisuse` when paramters passed from the client is invalid
`FeeRateTooHigh` when a channel cannot be opened due to high feerate
2018-08-17 13:09:30 -04:00
Matt Corallo
faf9864d9d Don't HTLC claim with no-possible-preimage in full_stack_target 2018-08-17 12:34:09 -04:00
Matt Corallo
03c6f84aa8
Merge pull request #116 from TheBlueMatt/2018-08-peer_handler-trace
Add some trace logging in peer_handler
2018-08-16 23:35:09 -04:00
Matt Corallo
4291cb99d4 Add some trace logging in peer_handler 2018-08-16 23:11:22 -04:00
Matt Corallo
7ee8ec70ac Default test logger to Trace to make error debugging easier 2018-08-16 23:11:22 -04:00
Matt Corallo
dc4af28759 Add some useful delayed-formatting formatters to macro_logger 2018-08-16 23:11:22 -04:00
Matt Corallo
ebd3bbba0f Remove some dead Logger code 2018-08-16 23:11:15 -04:00
Matt Corallo
50668644cf
Merge pull request #115 from TheBlueMatt/2018-08-channel-fuzz-fixes
Fixes from channelmanager fuzzing work
2018-08-16 23:04:12 -04:00
Matt Corallo
09583f3116 Fix PaymentReceived/sha256 handling in full_stack_target
Sha256 in fuzztarget was updated some time ago to use XOR instead
of the first byte of a real SHA256 run and somehow received and
sent payments got crossed in full_stack_target.
2018-08-16 22:37:44 -04:00
Matt Corallo
609054eae0 Handle duplicate funding transaction gracefully.
This can otherwise cause strange behavior, including a panic on
force_close_all_channels found by full_stack_target fuzzing.
2018-08-16 22:37:44 -04:00
Matt Corallo
b4078d992d Fix handle_funding_created bug/TODO
The fuzzer was able to tickle this
2018-08-16 22:37:41 -04:00
Matt Corallo
0f965d319f Fix bug in early-HTLC-fulfill handling
Caught by fuzzer. See new comments for more
2018-08-16 22:31:14 -04:00
Matt Corallo
b46878740c
Merge pull request #110 from TheBlueMatt/2018-08-router-crashes-2
Fix several fuzzer-found bugs
2018-08-16 22:07:47 -04:00
Matt Corallo
9362450c61 [Router] Remove channels from nodes when the channel is failed
Found by fuzzer
2018-08-16 20:51:50 -04:00
Matt Corallo
7c24fea4fe Handle only-path-overflows-fee in get_route and avoid PubKey::new()
Found by fuzzer
2018-08-16 20:51:50 -04:00
Matt Corallo
dde0ac4c29 Fix fee_base_msat overflowing entire fee range in RouteHint 2018-08-16 20:51:50 -04:00
Matt Corallo
0e6f028c3b Err from get_route if the requested value is more than 21m BTC
This fixes a potential overflow panic.
2018-08-16 20:51:50 -04:00
Matt Corallo
2a0ae96fdf Correct lowest_inbound_proportional_fee deduction in route finding
Found cause fuzzer was able to crash us if we don't
2018-08-16 20:51:50 -04:00
Matt Corallo
feb3db5ac8 Fix multiply-with-overflow panic in router
Found by fuzzer
2018-08-16 20:51:50 -04:00
Matt Corallo
1a9ef40203
Merge pull request #91 from ariard/logging_interface
Logging interface
2018-08-16 20:24:49 -04:00
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