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
b17211ffe4
Fix non-HTLC-inclusion balance calculation (mark II)
2018-07-30 18:29:03 -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
c26967348d
Remove some useless Vecs
2018-07-29 02:23:02 -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
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
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
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
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
158d0c16dc
Fix fee addition overflow in get_route
2018-07-25 18:10:46 -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
Matt Corallo
d4bb39a1dd
Ensure all msg deserialization can provide extra bytes, rename err
2018-07-25 15:56:46 -04:00
Matt Corallo
d7c1cfcc22
Make claim_funds_INTERNAL private
2018-07-24 22:33:12 -04:00
Matt Corallo
bdd77ae1fa
Do not pass DisconnectPeer events upstream to the client
2018-07-24 22:33:12 -04:00
Matt Corallo
af5c6e8186
PendingHTLCsForwardable really should just be upstreamed.
...
This is just a comment/docs/function rename change
2018-07-24 22:33:10 -04:00
Matt Corallo
b8b7cb238d
Convert fee API to per_kw instead of per_vb
...
This (a) cuts down a bit on some conversions, reducing chances for
bugsand (b) provides greater accuracy for clients.
2018-07-24 20:34:56 -04:00
Matt Corallo
d61abf6c04
Fix HTLC exclusion balance calculation criteria
2018-07-24 15:11:38 -04:00
Matt Corallo
ad147a20e6
Half-ass some CLTV fixes for real channel creation
2018-07-23 23:31:37 -04:00
Matt Corallo
12a55ae6fc
Set associated_data to payment_hash
2018-07-23 22:47:36 -04:00
Matt Corallo
ccf18e1b47
Short-circuit router for an outbound specified direct channel
2018-07-23 22:00:19 -04:00
Matt Corallo
ab22bed7ed
Fix OOM crash in ChannelMonitor::deserialize found by AFL
2018-07-23 15:01:25 -04:00
Antoine Riard
20fa9d331d
Add DisconnectPeer events
...
Add test for DisconnectPeer event
Update DisconnectPeer with optional ErrorMessage
Manage error for funding_transaction_generated
Add disconnect_socket to SocketDescriptor trait
2018-07-23 14:31:44 -04:00
Antoine Riard
1c12e83941
Implement ErrorMessage msg and ErrorAction::SendErrorMessage + fuzz test
2018-07-23 14:31:44 -04:00
Matt Corallo
fa9715dccf
Merge pull request #77 from TheBlueMatt/2018-07-route-tweaks
...
Add arg to get_route to specify our local channels explicitly
2018-07-23 13:57:00 -04:00
Matt Corallo
667cd66ede
Add arg to get_route to specify our local channels explicitly
...
(and a new getter in ChannelManager to get the thing to pass in)
2018-07-23 13:33:00 -04:00
Matt Corallo
0ee7b21819
Skip always iterating over all nodes in get_route
2018-07-23 13:12:39 -04:00
Matt Corallo
b9562b89c2
Merge pull request #76 from TheBlueMatt/2018-07-75-dangling-spaces
...
Remove dangling spaces from #75
2018-07-23 10:36:20 -04:00
Matt Corallo
ac941e19c9
Remove dangling spaces from #75
2018-07-22 23:54:30 -04:00
Matt Corallo
00bedd0a10
Merge pull request #75 from TheBlueMatt/2018-07-68-rebased
...
[msgs::ChannelReestablish] implement encoding and decoding
2018-07-22 23:53:08 -04:00
Savil Srivastava
0c1f47807a
[msgs::ChannelReestablish] implement encoding and decoding
...
Summary:
Implementing these, taking inspiration from the surrounding code since i'm a rust n00b.
Test Plan:
```
cargo build
cargo test channel_reestablish
```
output:
```
running 3 tests
test ln::msgs::tests::encoding_channel_reestablish_with_secret ... ok
test ln::msgs::tests::decode_channel_reestablish_bad_length ... ok
test ln::msgs::tests::encoding_channel_reestablish_no_secret ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 14 filtered out
```
2018-07-22 23:26:47 -04:00
Matt Corallo
7b4f382e26
Move shutdown sending to an event
2018-07-22 23:22:15 -04:00
Matt Corallo
e93c9fbeaf
Migrate all Uint256s used for channel_ids to [u8; 32]
2018-07-22 18:55:20 -04:00
Matt Corallo
456323886b
Merge pull request #71 from TheBlueMatt/2018-07-watch-funding
...
Ensure the funding transaction is registered to be monitored
2018-07-22 17:54:50 -04:00
Matt Corallo
896f5b8d91
Fix failure sending FundingLocked for non-announced channels
2018-07-22 17:11:20 -04:00
Matt Corallo
88c301cf08
Test transaction watch registration in channelmonitor tests
2018-07-22 13:59:11 -04:00
Matt Corallo
a611ae4741
Ensure the funding transaction is registered to be monitored
2018-07-22 13:59:11 -04:00
Matt Corallo
951c1d4145
Clarify get_peer_node_ids docs a bit
2018-07-22 13:11:58 -04:00
Yuntai Kyong
9679f708dc
add two methods for the issue #56
...
peer_handler::get_peer_node_ids() get connected peers' node_id
router::get_addresses() to get network addresses by node_id
2018-07-22 15:19:20 +09:00
Matt Corallo
372a80308b
Merge pull request #65 from TheBlueMatt/master
...
Bump version for API overhauls, update deps and docs
2018-07-19 23:31:37 -04:00
Matt Corallo
4afb0d85fa
Merge pull request #53 from savil/rename-error-msg-to-action
...
[HandleError] rename msg field to action
2018-07-19 23:30:28 -04:00
Matt Corallo
de523c4ca3
Merge pull request #47 from ariard/block_disconnected_close_chan
...
Implement channel closing for block_disconnected on ChainListener + test
2018-07-19 23:05:22 -04:00
Savil Srivastava
14c02c0652
update TODO message for renaming "msg" field of HandleError struct
2018-07-19 20:01:55 -07:00