Commit graph

7462 commits

Author SHA1 Message Date
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
Savil Srivastava
dfc3421302 add .editorconfig to ensure we use tabs, not spaces 2018-07-25 12:49:58 -07:00
Matt Corallo
29710eb4f0
Merge pull request #86 from TheBlueMatt/2018-07-event-fixes
Fix one bug on event handling, clean up docs
2018-07-24 22:59: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
29906e7995
Merge pull request #85 from TheBlueMatt/2018-07-fees
Convert fee API to per_kw instead of per_vb
2018-07-24 20:59:49 -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
f98d4b37d3
Merge pull request #82 from TheBlueMatt/2018-07-send-initial
Initial fixes for payment sending
2018-07-24 15:41:38 -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
Savil Srivastava
eb1eddcea0 [RFC][Tx Sort] Implement sorting of inputs
Follows BIP69: https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki

1. Implements sorting of transactoin inputs.
- BIP says to use "reversed byte-order" for the `prev_hash`. I interpreted this as: little-endian.
- TODO need to add tests

2. Re: improve sorting of TxOut's script_pubkey to use lexicographic ordering, and not length.
From the test-cases i've included it seems that the current code already does lexicographic ordering (and not length based). Am i missing something?
2018-07-23 20:26:26 -07:00
Matt Corallo
12a55ae6fc Set associated_data to payment_hash 2018-07-23 22:47:36 -04:00
Matt Corallo
7dac0bd1ff
Merge pull request #83 from TheBlueMatt/2018-07-direct-route
Short-circuit router for an outbound specified direct channel
2018-07-23 22:46:51 -04:00
Matt Corallo
ccf18e1b47 Short-circuit router for an outbound specified direct channel 2018-07-23 22:00:19 -04:00
Matt Corallo
7580b721ee
Merge pull request #79 from TheBlueMatt/2018-07-chanmon-oom
Fix OOM crash in ChannelMonitor::deserialize found by AFL
2018-07-23 15:26:09 -04:00
Matt Corallo
ab22bed7ed Fix OOM crash in ChannelMonitor::deserialize found by AFL 2018-07-23 15:01:25 -04:00
Matt Corallo
c0bcb4b532
Merge pull request #78 from TheBlueMatt/2018-07-43-rebased
Add DisconnectPeer event
2018-07-23 14:59:24 -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
Matt Corallo
83e3d67b79
Merge pull request #74 from TheBlueMatt/2018-07-shutdown-event
Move shutdown sending to an event
2018-07-22 23:44:55 -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
add1d9d9e5
Merge pull request #69 from savil/gen-target-fix
[fuzz] remove \L in sed regex for filenames in gen_target.sh
2018-07-22 23:25:30 -04:00
Matt Corallo
7b4f382e26 Move shutdown sending to an event 2018-07-22 23:22:15 -04:00
Matt Corallo
12583b63af
Merge pull request #73 from TheBlueMatt/2018-07-no-uint
Migrate all Uint256s used for channel_ids to [u8; 32]
2018-07-22 19:41:12 -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
27476d28b8
Merge pull request #70 from TheBlueMatt/master
Clarify get_peer_node_ids docs a bit
2018-07-22 13:39:27 -04:00
Matt Corallo
951c1d4145 Clarify get_peer_node_ids docs a bit 2018-07-22 13:11:58 -04:00
Matt Corallo
c3362a122e
Merge pull request #67 from yuntai/issue_56
#56 Expose list of pubkeys of connected peers from PeerHandler and addresses-by-pubkey from Router
2018-07-22 13:08:49 -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
Savil Srivastava
dee4ce5171 [fuzz] remove \L in sed regex for filenames in gen_target.sh
Summary:
on `master` branch, if i ran `gen_target.sh` i would get the following output:
https://gist.github.com/savil/2b3114eaf34c3ef8499b65005e374841

Without it, I get the files generated that are already checked-in (as expected).

Looking at the sed docs (https://www.gnu.org/software/sed/manual/html_node/Regular-Expressions.html) i don't see an explanation for what `\L` may do in whatever regex sed follows. Does this look correct? cc @yuntai
2018-07-20 23:00:31 -07: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
84cb40f859 Bump version for API overhauls, update deps and docs 2018-07-19 23:06:36 -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
Savil Srivastava
fd141bbed2 [Error] rename msg field to action
this was a TODO and also briefly discussed in https://github.com/rust-bitcoin/rust-lightning/pull/43#pullrequestreview-135649551

I'm not fully sure how to remove the `Option`, and make it completely required. Would love suggestions. So, have omitted that for now. Plus, better to make smaller, incremental changes.

Test Plan:
`cargo build`
`cargo test`
2018-07-19 20:01:55 -07:00
Matt Corallo
7098ca3375 Make some more things pub(crate) as they don't need exposed now 2018-07-19 22:54:45 -04:00