Commit graph

1593 commits

Author SHA1 Message Date
Matt Corallo
af69fae97b
Merge pull request #674 from TheBlueMatt/2020-08-keyif-rand-names
Simplify + clarify random-bytes-fetching from KeysInterface
2020-08-26 08:07:58 -07:00
Matt Corallo
501974db6d
Merge pull request #667 from valentinewallace/remove-channels-chanmon
Remove Channel's ChannelMonitor copy
2020-08-25 14:07:27 -07:00
Valentine Wallace
28d9036ce4
Remove Channel's ChannelMonitor copy 2020-08-25 16:37:53 -04:00
Valentine Wallace
ad18c4d853
Add commitment transaction broadcast as a ChannelMonitor event
To do this, we replace get_and_clear_pending_htlcs_updated with
get_and_clear_pending_monitor_events, and which still transmits HTLCUpdates
as before, but now also transmits a new MonitorEvent::CommitmentTxBroadcasted
event when a channel's commitment transaction is broadcasted.
2020-08-25 16:37:49 -04:00
Matt Corallo
7de6cb8dba
Merge pull request #675 from dspicher/master
Refactor route tests
2020-08-24 18:18:38 -07:00
Dominik Spicher
edeb122ce5 Refactor route tests
* Splits up the monolithic test into smaller unit tests

* Factors out helpers for graph setup

* Changes `id_to_feature_flags` to be a function, there was no
reason why it had to be a macro

* Activates a previously commented-out test that checks for
the failure case in `disable_node_test`
2020-08-25 00:50:54 +02:00
Matt Corallo
6497465762 Simplify + clarify random-bytes-fetching from KeysInterface
Due to a desire to be able to override temporary channel IDs and
onion keys, KeysInterface had two separate fetch-random-32-bytes
interfaces - an onion-key specific version which fetched 2 random
32 byte strings and a temporary-channel-id specific version.

It turns out, we never actually need to override both at once (as
creating a new channel and sending an outbound payment are always
separate top-level calls), so there's no reason to add two
functions to the interface when both really do the same thing.
2020-08-23 19:39:59 -04:00
Matt Corallo
b3b4f434a2
Merge pull request #665 from lightning-signer/pub-messages
Make message fields public
2020-08-23 14:28:29 -07:00
Devrandom
500c00ae9a Make message fields public 2020-08-23 22:11:06 +02:00
Matt Corallo
8ac0992b14
Merge pull request #671 from valentinewallace/bump-msrv
Bump MSRV to 1.30.0
2020-08-19 13:04:41 -07:00
Valentine Wallace
0ac5697bb8
Bump MSRV to 1.30.0
We wanted to bump to 1.29 to continue to support mrustc bootstrapping, but on 1.29
there's a bug preventing us from compiling the lightning package only, thus parts
of lightning-net-tokio cause a compilation error.

The advantage of bumping the MSRV is an improved borrow checker which should
enable improved code quality, and not having jump through weird hoops sometimes
to get 1.22 working.
2020-08-19 15:39:03 -04:00
Matt Corallo
d0b4f521e1
Merge pull request #669 from joemphilips/fix_capacity-is-always-zero-bug_in_list_channels
Fix bug in Channel
2020-08-13 14:06:39 -07:00
Matt Corallo
7dca3a9e29
Merge pull request #668 from lightning-signer/nit
fix typo
2020-08-13 10:08:21 -07:00
joe.miyamoto
54916db957
Fix bug in Channel
Before this commit, `fn get_inbound_outbound_available_balance_msat` always returns 0.
It is because using `cmp::min` instead of `cmp::max` .
2020-08-13 17:10:24 +09:00
Devrandom
c3a90a2d56 fix typo 2020-08-13 09:58:55 +02:00
Matt Corallo
1d2d393258
Merge pull request #662 from lightning-signer/compat5
Export various fields and structures
2020-08-11 09:10:05 -07:00
Devrandom
fd2db4028a check the input shape in LocalCommitmentTransaction.new_missing_local_sig 2020-08-11 11:00:32 +02:00
Devrandom
f60026387e make LocalCommitmentTransaction constructor public
Allows calling of InMemoryChannelKeys methods
2020-08-11 09:23:31 +02:00
Devrandom
31b4d89cde make SimpleManyChannelMonitor.monitors public 2020-08-11 09:23:31 +02:00
Devrandom
ce0cecd50a export "unsafe_revoked_tx_signing" feature
Allows unsafe signing in dev code, such as functional testing of
justice transactions outside our crate.
2020-08-11 09:23:31 +02:00
Matt Corallo
22a0dd5f33
Merge pull request #666 from TheBlueMatt/2020-08-license-change
Relicense as dual Apache-2.0 + MIT
2020-08-10 18:30:38 -07:00
Matt Corallo
4395b92cc8 Relicense as dual Apache-2.0 + MIT
This changes the LICENSE file and adds license headers to most files
to relicense under dual Apache-2.0 and MIT. This is helpful in that
we retain the patent grant issued under Apache-2.0-licensed work,
avoiding some sticky patent issues, while still allowing users who
are more comfortable with the simpler MIT license to use that.

See https://github.com/rust-bitcoin/rust-lightning/issues/659 for
relicensing statements from code authors.
2020-08-10 21:12:44 -04:00
Matt Corallo
093fcaba68
Merge pull request #664 from lightning-signer/tx-creation-keys
Wrap transaction creation keys
2020-08-10 13:25:03 -07:00
Devrandom
8058202c4c nit 2020-08-10 22:09:03 +02:00
Devrandom
6f635c6bc3 Expose TxCreationKeys in LocalCommitmentTransaction via a method
This makes it obvious to signer implementers that the pre-derived keys are a local cache and should not be trusted in a validating signer.
2020-08-10 20:22:01 +02:00
Devrandom
d2e6f2ac18 Make TxCreationKeys public and wrap it in PreCalculatedTxCreationKeys
Allows calling of InMemoryChannelKeys methods.

The wrapping makes it obvious to signer implementers that the pre-derived keys are a local cache and should not be trusted in a validating signer.
2020-08-10 20:21:07 +02:00
Matt Corallo
99eef23f4e
Merge pull request #640 from valentinewallace/test-holding-cell-edge-case
Fail back HTLCs that fail to be freed from the holding cell
2020-08-08 14:20:09 -07:00
Valentine Wallace
523cab8ef7
Holding cell: if we fail to free an HTLC, fail it backwards
Plus add a test.
2020-08-08 16:32:15 -04:00
Matt Corallo
d735a24e6a
Merge pull request #663 from TheBlueMatt/2020-08-codecov
Set codecov upload token
2020-08-03 14:25:56 -07:00
Matt Corallo
7b0483eba8 Set codecov upload token
Docs seem to indicate this should only be required for private
repos, but we have builds failing claiming this needs to be
specified, so just set it manually.
2020-08-03 17:09:27 -04:00
Matt Corallo
1d28a71c15
Merge pull request #658 from lightning-signer/self-delay
ChannelKeys - provide to_self_delay alongside the remote channel pubkeys
2020-07-29 12:08:13 -07:00
Devrandom
48d73b3264 ChannelKeys - provide to_self_delay alongside the remote channel pubkeys
In the phase 2 signer, we will construct the commitment transaction inside the signer.
In preparation, provide needed channel related data.
2020-07-29 20:43:39 +02:00
Matt Corallo
779ff6721b
Merge pull request #651 from naumenkogs/2020-06-routing-data-improvements
Routing improvements
2020-07-27 10:18:13 -07:00
Gleb Naumenko
dd0e4f4034 Check htlc_maximum_msat on channel update 2020-07-27 14:06:20 +03:00
Gleb Naumenko
3a57cfc7c6 Store channel capacity if available 2020-07-27 14:06:20 +03:00
Gleb Naumenko
8b4f6e8861 Add htlc_maximum_msat field 2020-07-27 14:06:16 +03:00
Gleb Naumenko
b8fc761dc1 Update comment for test_msg_hole 2020-07-24 10:19:45 +03:00
Matt Corallo
ed84b02a0a
Merge pull request #655 from lightning-signer/per-commitment
ChannelKeys - separate commitment revocation from getting the per-commitment point
2020-07-22 13:11:45 -07:00
Devrandom
b19d4475cb ChannelKeys - separate commitment revocation from getting the per-commitment point
The commitment secret is sensitive - it can be used by an attacker to
steal funds if the node also signs the same transaction. Therefore,
only release the secret from ChannelKeys when we are revoking a
transaction.
2020-07-22 11:47:10 -07:00
Gleb Naumenko
a66b8017c0 Improve routing announcement test 2020-07-22 16:21:04 +03:00
Gleb Naumenko
430d57c610 Fix formatting 2020-07-22 16:21:04 +03:00
Gleb Naumenko
5309197150 Use constant for max msats 2020-07-22 16:21:04 +03:00
Gleb Naumenko
7838727a5c Update get_route comment to reflect new parameters 2020-07-22 16:20:19 +03:00
Matt Corallo
50df4cf464
Merge pull request #644 from joemphilips/improve_error_message
Improve error message.
2020-07-21 20:04:44 -07:00
Matt Corallo
5a1c0ccbf8
Merge pull request #623 from LNP-BP/feat-msgsizelimit
Making message size limit an exportable constant
2020-07-21 20:03:37 -07:00
joe.miyamoto
407e306a99
slightly refactor internal_announcement_signatures
For making debugging easy.
If the user gives a different node_secret for transport
layer (`PeerManager`) and for routing msg, internal_announcement_signatures
is the first place it causes an error.
By giving a detailed error message, user will be able to
fix the bug quickly.
2020-07-22 10:34:47 +09:00
joe.miyamoto
1fc6d6b5ee
Improve error message.
... for ChannelError and APIMisuseError
Before this commit, When rl returns error, we don't know
The actual parameter which caused the error.
By returning parameterised `String` instead of predefined `&'static str`,
We can give a caller improved error message.

TestLogger now has two additional methods
1. `assert_log_contains` which checks the logged messsage
  has how many entry which includes the specified string as a substring.
2. `aasert_log_regex` mostly the same with `assert_log_contains`
  but it is more flexible that caller specifies regex which has
  to be satisfied instead of just a substring.
For regex, tests now includes `regex` as dev-dependency.
2020-07-22 10:34:47 +09:00
Dr. Maxim Orlovsky
4bb5955be9 Moving LN_MAX_MSG_LEN const to the actual use place 2020-07-21 18:53:55 +02:00
Dr. Maxim Orlovsky
0e5dfadf64 Removing spec quotation from LN_MAX_MSG_LEN definition 2020-07-21 18:10:58 +02:00
Dr. Maxim Orlovsky
eae748a7b2 Removing duplicated code in message decryption test cases 2020-07-21 18:10:58 +02:00