rust-lightning
3 years agoMention storage req for users with a public invoice generation API 2021-04-mention-invoice-storage-docs
Matt Corallo [Thu, 29 Apr 2021 19:31:35 +0000 (19:31 +0000)]
Mention storage req for users with a public invoice generation API

3 years agoMerge pull request #903 from TheBlueMatt/2021-04-invoice-bindings
Matt Corallo [Thu, 29 Apr 2021 18:57:37 +0000 (18:57 +0000)]
Merge pull request #903 from TheBlueMatt/2021-04-invoice-bindings

Prepare lightning-invoice for export in C

3 years agoDrop redundant generic parameter bounds on ChainMonitor trait impls 2021-04-invoice-bindings
Matt Corallo [Thu, 29 Apr 2021 16:46:20 +0000 (16:46 +0000)]
Drop redundant generic parameter bounds on ChainMonitor trait impls

The ChannelSigner bounds are specified both in `impl<>` and in the
`where` clause, which the C bindings generator doesn't like. There
is no reason to have them specified twice.

3 years agoAdd no-export tags for lightning-invoice where we can't map to C
Matt Corallo [Fri, 16 Apr 2021 22:32:49 +0000 (22:32 +0000)]
Add no-export tags for lightning-invoice where we can't map to C

3 years agoRename lightning_invoice::Signature to InvoiceSignature
Matt Corallo [Thu, 29 Apr 2021 15:47:08 +0000 (15:47 +0000)]
Rename lightning_invoice::Signature to InvoiceSignature

This prevents aliasing the global secp256k1::Signature name in C
bindings and also makes it a little more explicit that the object
is different from other signature types.

3 years agoDo not return a reference to a u64 in rust-lightning-invoices
Matt Corallo [Fri, 23 Apr 2021 00:25:55 +0000 (00:25 +0000)]
Do not return a reference to a u64 in rust-lightning-invoices

There is generally never a reason to return a non-mutable reference
to a u64 vs just copying it, same applies here. It makes the API
slightly less consistent, but is easier to map in bindings and just
makes more sense.

3 years agoMerge pull request #900 from lightning-signer/init-asap
Matt Corallo [Thu, 29 Apr 2021 00:26:13 +0000 (00:26 +0000)]
Merge pull request #900 from lightning-signer/init-asap

Send Init message immediately after handshake even if not initiator

3 years agoMerge pull request #902 from TheBlueMatt/2021-04-fix-fuzz-test
Matt Corallo [Thu, 29 Apr 2021 00:24:40 +0000 (00:24 +0000)]
Merge pull request #902 from TheBlueMatt/2021-04-fix-fuzz-test

Fix fuzz secp patch by bumping the rust-secp version number in patch

3 years agoMerge pull request #893 from TheBlueMatt/2021-04-features-chanman
Matt Corallo [Wed, 28 Apr 2021 19:59:33 +0000 (19:59 +0000)]
Merge pull request #893 from TheBlueMatt/2021-04-features-chanman

Require payment secrets and track them in ChannelManager

3 years agoAdd a const and docs for the min `min_final_cltv_expiry` we allow 2021-04-features-chanman
Matt Corallo [Tue, 27 Apr 2021 16:06:00 +0000 (16:06 +0000)]
Add a const and docs for the min `min_final_cltv_expiry` we allow

3 years agoAdd some simple tests of payment secret tracking
Matt Corallo [Wed, 28 Apr 2021 18:59:54 +0000 (14:59 -0400)]
Add some simple tests of payment secret tracking

3 years agoFail PendingInboundPayments after their expiry time is reached
Matt Corallo [Fri, 23 Apr 2021 23:56:58 +0000 (23:56 +0000)]
Fail PendingInboundPayments after their expiry time is reached

3 years agoGive users who use `get_payment_secret_preimage` the PaymentPreimage
Matt Corallo [Fri, 23 Apr 2021 22:24:47 +0000 (22:24 +0000)]
Give users who use `get_payment_secret_preimage` the PaymentPreimage

For users who get PaymentPreimages via
`get_payment_secret_preimage`, they need to provide the
PaymentPreimage back in `claim_funds` but they aren't actually
given the preimage anywhere.

This commit gives users the PaymentPreimage in the
`PaymentReceived` event.

3 years agoMake the PaymentSecret in `PaymentReceived` events non-Optional
Matt Corallo [Fri, 23 Apr 2021 16:53:53 +0000 (16:53 +0000)]
Make the PaymentSecret in `PaymentReceived` events non-Optional

3 years agoDrop the amount parameter to claim_funds
Matt Corallo [Mon, 26 Apr 2021 23:05:56 +0000 (23:05 +0000)]
Drop the amount parameter to claim_funds

Like the payment_secret parameter, this paramter has been the source
of much confusion, so we just drop it.

Users should prefer to do this check when registering the payment
secret instead of at claim-time.

3 years agoDrop now-useless PaymentSecret parameters when claiming/failing-back
Matt Corallo [Fri, 23 Apr 2021 03:00:44 +0000 (03:00 +0000)]
Drop now-useless PaymentSecret parameters when claiming/failing-back

3 years agoAdd a `user_payment_id` to `get_payment_secret`+`PaymentReceived`
Matt Corallo [Tue, 27 Apr 2021 01:29:39 +0000 (01:29 +0000)]
Add a `user_payment_id` to `get_payment_secret`+`PaymentReceived`

This allows users to store metadata about an invoice at
invoice-generation time and then index into that storage with a
general-purpose id when they call `get_payment_secret`. They will
then be provided the same index when the payment has been received.

3 years agoDrop dead code for handling non-MPP payments in claim_funds
Matt Corallo [Fri, 23 Apr 2021 04:08:41 +0000 (04:08 +0000)]
Drop dead code for handling non-MPP payments in claim_funds

3 years ago[fuzz] Always use PaymentSecrets in chanmon_consistency
Matt Corallo [Fri, 23 Apr 2021 19:04:02 +0000 (19:04 +0000)]
[fuzz] Always use PaymentSecrets in chanmon_consistency

3 years agoReq+check payment secrets for inbound payments pre-PaymentReceived
Matt Corallo [Fri, 23 Apr 2021 04:04:55 +0000 (04:04 +0000)]
Req+check payment secrets for inbound payments pre-PaymentReceived

Our current PaymentReceived API is incredibly easy to mis-use -
the "obvious" way to implement a client is to always call
`ChannelManager::claim_funds` in response to a `PaymentReceived`
event. However, users are *required* to check the payment secret
and value against the expected values before claiming in order to
avoid a number of potentially funds-losing attacks.

Instead, if we rely on payment secrets being pre-registered with
the ChannelManager before we receive HTLCs for a payment we can
simply check the payment secrets and never generate
`PaymentReceived` events if they do not match. Further, when the
user knows the value to expect in advance, we can have them
register it as well, allowing us to check it for them.

Other implementations already require payment secrets for inbound
payments, so this shouldn't materially lose compatibility.

3 years agoUse payment_secrets in all sends in functional tests
Matt Corallo [Fri, 23 Apr 2021 03:19:52 +0000 (03:19 +0000)]
Use payment_secrets in all sends in functional tests

This prepares us for requiring payment_secrets for all received
payments, by demonstrating test changes work even prior to the new
requirement.

In order to avoid needing to pipe payment secrets through to
additional places in the claim logic and then removing that
infrastructure once payment secrets are required, we use the new
payment secret storage in ChannelManager to look up the payment
secret for any given pament hash in claim and fail-back functions.
This part of the diff is reverted in the next commit.

3 years agoUse known InvoiceFeatures for routing in tests
Matt Corallo [Fri, 23 Apr 2021 03:15:37 +0000 (03:15 +0000)]
Use known InvoiceFeatures for routing in tests

3 years agoPipe through PaymentSecrets in tests during payment hash creation
Matt Corallo [Thu, 22 Apr 2021 22:45:14 +0000 (22:45 +0000)]
Pipe through PaymentSecrets in tests during payment hash creation

In order to reduce code movement in the next commit, this commit
simply tweaks get_payment_preimage_hash!() and related functions in
functional tests to return a payment secret. Further, we ensure
that we always call get_payment_preimage_hash!() with the node
which will ultimately receive the payment.

3 years agoDRY the get_route_and_payment_hash!() macro duplicated in tests
Matt Corallo [Thu, 22 Apr 2021 19:13:14 +0000 (19:13 +0000)]
DRY the get_route_and_payment_hash!() macro duplicated in tests

3 years agoAdd payment secret and preimage tracking in ChannelManager
Matt Corallo [Thu, 22 Apr 2021 18:35:01 +0000 (18:35 +0000)]
Add payment secret and preimage tracking in ChannelManager

This adds support for tracking payment secrets and (optionally)
payment preimages in ChannelManager. This potentially makes client
implementations much simper as they don't have to have external
payment preimage tracking.

This doesn't yet use such tracking anywhere.

3 years agoFix fuzz secp patch by bumping the rust-secp version number in patch 2021-04-fix-fuzz-test
Matt Corallo [Wed, 28 Apr 2021 19:17:59 +0000 (15:17 -0400)]
Fix fuzz secp patch by bumping the rust-secp version number in patch

3 years agoSend Init message immediately after handshake even if not initiator
Devrandom [Wed, 28 Apr 2021 13:22:34 +0000 (15:22 +0200)]
Send Init message immediately after handshake even if not initiator

We were waiting for the initiator, but the spec doesn't guarantee that they will send Init first, so we might theoretically wait forever.

Also, lnprototest expects this behavior.

3 years agoSet payment_secret to required in features flags
Matt Corallo [Thu, 22 Apr 2021 18:54:53 +0000 (18:54 +0000)]
Set payment_secret to required in features flags

3 years agoMerge pull request #854 from TheBlueMatt/2021-03-fix-lens
Matt Corallo [Tue, 27 Apr 2021 02:05:29 +0000 (02:05 +0000)]
Merge pull request #854 from TheBlueMatt/2021-03-fix-lens

Fix serialization expected lengths and check them in test/fuzzing

3 years agoUse more descriptive names in serialization impl macros 2021-03-fix-lens
Matt Corallo [Wed, 24 Mar 2021 18:31:03 +0000 (14:31 -0400)]
Use more descriptive names in serialization impl macros

3 years agoFix serialization expected lengths and check them in test/fuzzing
Matt Corallo [Mon, 22 Mar 2021 22:27:34 +0000 (18:27 -0400)]
Fix serialization expected lengths and check them in test/fuzzing

3 years agoMerge pull request #897 from TheBlueMatt/2021-04-fix-ci
Matt Corallo [Tue, 27 Apr 2021 01:06:11 +0000 (01:06 +0000)]
Merge pull request #897 from TheBlueMatt/2021-04-fix-ci

Bump MSRV to 1.36

3 years agoTest lightning-persister on rustc 1.36 as well 2021-04-fix-ci
Matt Corallo [Mon, 26 Apr 2021 17:48:57 +0000 (17:48 +0000)]
Test lightning-persister on rustc 1.36 as well

3 years agoBump MSRV to 1.36.0
Matt Corallo [Mon, 26 Apr 2021 17:47:47 +0000 (17:47 +0000)]
Bump MSRV to 1.36.0

Debian is shipping 1.41 on oldstable and rust-bitcoin will likely
move to 1.36 over the coming months, so there's little reason to
wait on this.

cc https://github.com/rust-bitcoin/rust-bitcoin/issues/510

3 years agoMerge pull request #894 from TheBlueMatt/2021-04-fix-docs
Matt Corallo [Mon, 26 Apr 2021 19:59:32 +0000 (19:59 +0000)]
Merge pull request #894 from TheBlueMatt/2021-04-fix-docs

Fix doc resolution in rustc 1.48

3 years agoMerge pull request #876 from valentinewallace/invoice-features
Matt Corallo [Mon, 26 Apr 2021 18:00:33 +0000 (18:00 +0000)]
Merge pull request #876 from valentinewallace/invoice-features

Invoice features

3 years agoAdd Features feature to invoices.
Valentine Wallace [Fri, 16 Apr 2021 19:29:33 +0000 (15:29 -0400)]
Add Features feature to invoices.

3 years agoMerge pull request #890 from TheBlueMatt/2021-04-fix-chan-shutdown-crash
Matt Corallo [Sat, 24 Apr 2021 00:03:42 +0000 (00:03 +0000)]
Merge pull request #890 from TheBlueMatt/2021-04-fix-chan-shutdown-crash

Fix (and test) panic when our counterparty uses a bogus funding tx

3 years agoFix (and test) panic when our counterparty uses a bogus funding tx 2021-04-fix-chan-shutdown-crash
Matt Corallo [Wed, 21 Apr 2021 00:11:54 +0000 (00:11 +0000)]
Fix (and test) panic when our counterparty uses a bogus funding tx

During the block API refactor, we started calling
Channel::force_shutdown when a channel is closed due to a bogus
funding tx. However, we still set the channel's state to Shutdown
prior to doing so, leading to an assertion in force_shutdown (that
the channel is not already closed).

This removes the state-set call and adds a (long-overdue) test for
this case.

Fixes: 60b962a18ebcf494340ddc001870f8160c625968
3 years agoExpose Features::from_le_bytes() method
Valentine Wallace [Fri, 16 Apr 2021 19:26:38 +0000 (15:26 -0400)]
Expose Features::from_le_bytes() method

Useful for constructing features objects from raw feature bytes.

3 years agoFix indentation in payment_secret function
Valentine Wallace [Tue, 13 Apr 2021 14:34:33 +0000 (10:34 -0400)]
Fix indentation in payment_secret function

3 years agoFix doc resolution in rustc 1.48 2021-04-fix-docs
Matt Corallo [Fri, 23 Apr 2021 20:42:11 +0000 (20:42 +0000)]
Fix doc resolution in rustc 1.48

3 years agoMerge pull request #889 from jkczyz/2021-04-electrum-trait
Matt Corallo [Fri, 23 Apr 2021 19:13:23 +0000 (19:13 +0000)]
Merge pull request #889 from jkczyz/2021-04-electrum-trait

Define chain::Confirm trait for use by Electrum clients

3 years agoDrop pub functions for ChainMonitor's Listen impl
Jeffrey Czyz [Thu, 22 Apr 2021 16:52:10 +0000 (09:52 -0700)]
Drop pub functions for ChainMonitor's Listen impl

3 years agoImplement chain::Confirm for ChainMonitor
Jeffrey Czyz [Thu, 22 Apr 2021 07:11:00 +0000 (00:11 -0700)]
Implement chain::Confirm for ChainMonitor

3 years agoImplement chain::Confirm for relevant structs
Jeffrey Czyz [Tue, 20 Apr 2021 20:39:00 +0000 (13:39 -0700)]
Implement chain::Confirm for relevant structs

3 years agoDefine chain::Confirm trait
Jeffrey Czyz [Tue, 20 Apr 2021 17:24:08 +0000 (10:24 -0700)]
Define chain::Confirm trait

Define a separate trait akin to chain::Listen for notifying when
transactions have been confirmed on chain or unconfirmed during a chain
reorganization. Whereas chain::Listen is used for block-oriented chain
sources, chain::Confirm is used for chain sources supplying data for
activity related to transactions and outputs registered via
chain::Filter.

3 years agoMerge pull request #891 from TheBlueMatt/2021-04-peer_handler_lock
Matt Corallo [Thu, 22 Apr 2021 14:16:05 +0000 (14:16 +0000)]
Merge pull request #891 from TheBlueMatt/2021-04-peer_handler_lock

[peer_handler] Take the peers lock before getting messages to send

3 years ago[peer_handler] Take the peers lock before getting messages to send 2021-04-peer_handler_lock
Matt Corallo [Wed, 21 Apr 2021 21:50:41 +0000 (21:50 +0000)]
[peer_handler] Take the peers lock before getting messages to send

Previously, if a user simultaneously called
`PeerHandler::process_events()` from two threads, we'd race, which
ended up sending messages out-of-order in the real world.
Specifically, we first called `get_and_clear_pending_msg_events`,
then take the `peers` lock and push the messages we got into the
sending queue. Two threads may both get some set of messages to
send, but then race each other into the `peers` lock and send the
messages in random order.

Because we already hold the `peers` lock when calling most message
handler functions, we can simply take the lock before calling
`get_and_clear_pending_msg_events`, solving the race.

3 years agoMerge pull request #887 from valentinewallace/invoice-use-RL-routehint
Matt Corallo [Wed, 21 Apr 2021 15:21:39 +0000 (15:21 +0000)]
Merge pull request #887 from valentinewallace/invoice-use-RL-routehint

invoice: swap RouteHop for RouteHint

3 years agoTest lightning-invoice on 1.30.0
Valentine Wallace [Tue, 20 Apr 2021 19:46:58 +0000 (15:46 -0400)]
Test lightning-invoice on 1.30.0

3 years agoinvoice: rename Route to RouteHint (which is more accurate)
Valentine Wallace [Mon, 19 Apr 2021 22:22:21 +0000 (18:22 -0400)]
invoice: rename Route to RouteHint (which is more accurate)

3 years agoRename RouteHint to RouteHintHop (which is more accurate)
Valentine Wallace [Mon, 19 Apr 2021 22:12:51 +0000 (18:12 -0400)]
Rename RouteHint to RouteHintHop (which is more accurate)

3 years agoinvoice: swap RouteHop for RouteHint
Valentine Wallace [Fri, 16 Apr 2021 20:17:11 +0000 (16:17 -0400)]
invoice: swap RouteHop for RouteHint

To prevent naming conflicts in bindings

3 years agoMerge pull request #844 from sr-gi/843-ln-signing
Matt Corallo [Tue, 20 Apr 2021 00:45:30 +0000 (00:45 +0000)]
Merge pull request #844 from sr-gi/843-ln-signing

Adds lightning message signing/verification/pk_recovery

3 years agoChanges zbase32 crate from pub to pub(crate)
Sergi Delgado Segura [Wed, 31 Mar 2021 09:38:31 +0000 (11:38 +0200)]
Changes zbase32 crate from pub to pub(crate)

3 years agoCorrect license header in zbase32 to match original work
Matt Corallo [Mon, 22 Mar 2021 16:22:24 +0000 (12:22 -0400)]
Correct license header in zbase32 to match original work

The original work is licensed dual MIT+Apache-2 just like us, so
the license header should not only mention MIT.

3 years agoReplace spaces with tabs in zbase32.rs
Matt Corallo [Mon, 22 Mar 2021 16:20:26 +0000 (12:20 -0400)]
Replace spaces with tabs in zbase32.rs

3 years agoFix a number of bugs in zbase32 and add a fuzzer which caught them.
Matt Corallo [Mon, 22 Mar 2021 16:19:28 +0000 (12:19 -0400)]
Fix a number of bugs in zbase32 and add a fuzzer which caught them.

3 years agoAdds lightning message signing/verification/pk_recovery
Sergi Delgado Segura [Tue, 16 Mar 2021 14:55:44 +0000 (15:55 +0100)]
Adds lightning message signing/verification/pk_recovery

3 years agoMerge pull request #886 from TheBlueMatt/2021-04-pub-alias
Matt Corallo [Thu, 15 Apr 2021 21:55:53 +0000 (21:55 +0000)]
Merge pull request #886 from TheBlueMatt/2021-04-pub-alias

Make the used-in-pub-interfaces TransactionOutputs type alias pub

3 years agoMerge pull request #884 from TheBlueMatt/2021-04-bp-bindings
Matt Corallo [Thu, 15 Apr 2021 20:11:19 +0000 (20:11 +0000)]
Merge pull request #884 from TheBlueMatt/2021-04-bp-bindings

Prep background-processor for bindings inclusion

3 years agoMake the used-in-pub-interfaces TransactionOutputs type alias pub 2021-04-pub-alias
Matt Corallo [Thu, 15 Apr 2021 20:10:21 +0000 (16:10 -0400)]
Make the used-in-pub-interfaces TransactionOutputs type alias pub

3 years agoRename background-processor to lightning-... to match other crates 2021-04-bp-bindings
Matt Corallo [Tue, 13 Apr 2021 23:39:32 +0000 (19:39 -0400)]
Rename background-processor to lightning-... to match other crates

3 years agoUse a trait to handle ChannelManager persistence instead of an Fn
Matt Corallo [Tue, 13 Apr 2021 23:38:31 +0000 (19:38 -0400)]
Use a trait to handle ChannelManager persistence instead of an Fn

This avoids having to write new support for closures in the C
bindings generation but, more importantly, we really need to also
be handling Events in the same trait, so it makes sense to go ahead
and convert it.

For compatibility, the trait is implemented for any matching
closure.

3 years agoLoosen background-persister so bindings are happy
Matt Corallo [Tue, 13 Apr 2021 20:04:17 +0000 (16:04 -0400)]
Loosen background-persister so bindings are happy

3 years agoMerge pull request #858 from jkczyz/2021-03-electrum-interface
Matt Corallo [Thu, 15 Apr 2021 14:25:54 +0000 (14:25 +0000)]
Merge pull request #858 from jkczyz/2021-03-electrum-interface

Electrum interface for ChannelMonitor

3 years agoRename onchain_events_waiting_threshold_conf
Jeffrey Czyz [Mon, 12 Apr 2021 18:47:23 +0000 (11:47 -0700)]
Rename onchain_events_waiting_threshold_conf

3 years agoParameterize test_htlc_on_chain_timeout
Jeffrey Czyz [Sat, 10 Apr 2021 07:32:08 +0000 (00:32 -0700)]
Parameterize test_htlc_on_chain_timeout

This test failed when ConnectionStyle was set to a SkippingBlocks
variant because of a bug in ChannelMonitor::update_best_block.
Parameterize the test with these styles to catch any regressions.

3 years agoTest ChainMonitor's Electrum interface
Jeffrey Czyz [Wed, 7 Apr 2021 19:02:33 +0000 (12:02 -0700)]
Test ChainMonitor's Electrum interface

3 years agoReuse txdata in functional_test_utils.rs
Jeffrey Czyz [Wed, 7 Apr 2021 18:43:32 +0000 (11:43 -0700)]
Reuse txdata in functional_test_utils.rs

3 years agoAdd an internal typedef for transaction outputs
Jeffrey Czyz [Fri, 2 Apr 2021 23:53:00 +0000 (16:53 -0700)]
Add an internal typedef for transaction outputs

3 years agoRemove unnecessary script_pubkey clones
Jeffrey Czyz [Fri, 2 Apr 2021 22:31:20 +0000 (15:31 -0700)]
Remove unnecessary script_pubkey clones

3 years agoElectrum interface for ChainMonitor
Jeffrey Czyz [Fri, 2 Apr 2021 22:03:41 +0000 (15:03 -0700)]
Electrum interface for ChainMonitor

Add an interface to ChainMonitor for Electrum users, delegating to the
corresponding methods in each ChannelMonitor.

3 years agoAdd ChannelMonitor::get_relevant_txids
Jeffrey Czyz [Mon, 5 Apr 2021 20:18:27 +0000 (13:18 -0700)]
Add ChannelMonitor::get_relevant_txids

Define an Electrum-friendly interface for ChannelMonitor where txids of
relevant transactions can be obtained. For any of these transactions
that are re-orged out of the chain, users must call
transaction_unconfirmed.

3 years agoAdd ChannelMonitor::transaction_unconfirmed
Jeffrey Czyz [Sat, 27 Mar 2021 20:26:45 +0000 (16:26 -0400)]
Add ChannelMonitor::transaction_unconfirmed

Define an Electrum-friendly interface for ChannelMonitor where
transactions are unconfirmed independently from updating the latest
block.

3 years agoAdd ChannelMonitor::update_best_block
Jeffrey Czyz [Fri, 2 Apr 2021 02:44:46 +0000 (19:44 -0700)]
Add ChannelMonitor::update_best_block

Expose a way for Electrum users to update the best block on a
ChannelMonitor independently of confirming transactions.

3 years agoAdd ChannelMonitor::transactions_confirmed
Jeffrey Czyz [Wed, 24 Mar 2021 22:47:44 +0000 (18:47 -0400)]
Add ChannelMonitor::transactions_confirmed

Define an Electrum-friendly interface for ChannelMonitor where
transactions are confirmed independently of updating the last connected
block.

3 years agoTrack block height in ChannelMonitor
Jeffrey Czyz [Tue, 6 Apr 2021 18:34:17 +0000 (11:34 -0700)]
Track block height in ChannelMonitor

3 years agoCombine ChannelManager's block hash and height
Jeffrey Czyz [Fri, 9 Apr 2021 06:36:30 +0000 (23:36 -0700)]
Combine ChannelManager's block hash and height

There is a possible race condition when both the latest block hash and
height are needed. Combine these in one struct and place them behind a
single lock.

3 years agoAdd txid to on-chain event tracking
Jeffrey Czyz [Wed, 31 Mar 2021 17:54:01 +0000 (13:54 -0400)]
Add txid to on-chain event tracking

When using Electrum, transactions are individually unconfirmed during a
reorg rather than by block. Store the txid of the transaction creating
the on-chain event so that it can be used to determine which events need
to be removed when a transaction is unconfirmed.

3 years agoCheck for duplicate HTLC events having matured
Jeffrey Czyz [Sat, 10 Apr 2021 01:38:03 +0000 (18:38 -0700)]
Check for duplicate HTLC events having matured

3 years agoFlatten onchain_events_waiting_threshold_conf
Jeffrey Czyz [Wed, 31 Mar 2021 17:23:57 +0000 (13:23 -0400)]
Flatten onchain_events_waiting_threshold_conf

Rather than mapping height to a vector of events, use a single vector
for all events. This allows for easily processing events by either
height or transaction. The latter will be used for an interface suitable
for Electrum.

3 years agoMerge pull request #853 from TheBlueMatt/2021-03-transaction_unconfirmed
Matt Corallo [Wed, 14 Apr 2021 18:50:52 +0000 (18:50 +0000)]
Merge pull request #853 from TheBlueMatt/2021-03-transaction_unconfirmed

Add method to note transaction unconfirmed/reorged-out

3 years agoTest new transactions_unconfirmed 2021-03-transaction_unconfirmed
Matt Corallo [Mon, 22 Mar 2021 22:07:13 +0000 (18:07 -0400)]
Test new transactions_unconfirmed

3 years agoExpose ChannelManager's current config and use it in reload in tests
Matt Corallo [Mon, 22 Mar 2021 21:59:59 +0000 (17:59 -0400)]
Expose ChannelManager's current config and use it in reload in tests

3 years agoAdd method to note transaction unconfirmed/reorged-out
Matt Corallo [Mon, 22 Mar 2021 21:01:04 +0000 (17:01 -0400)]
Add method to note transaction unconfirmed/reorged-out

3 years agoMerge pull request #885 from p2pderivatives/use-secp256k1-consts-in-ser
Matt Corallo [Wed, 14 Apr 2021 02:20:27 +0000 (02:20 +0000)]
Merge pull request #885 from p2pderivatives/use-secp256k1-consts-in-ser

Fix size check in Vec<Signature> serialization + use consts

3 years agoMerge pull request #875 from TheBlueMatt/2021-04-fix-bench
Matt Corallo [Wed, 14 Apr 2021 01:51:33 +0000 (01:51 +0000)]
Merge pull request #875 from TheBlueMatt/2021-04-fix-bench

Fix benchmark compile warnings and errors

3 years agoFix size check in Vec<Signature> serialization + use consts
Tibo-lg [Wed, 14 Apr 2021 01:37:49 +0000 (10:37 +0900)]
Fix size check in Vec<Signature> serialization + use consts

3 years agoFix compile warning with --cfg require_route_graph_test 2021-04-fix-bench
Matt Corallo [Tue, 13 Apr 2021 00:33:53 +0000 (20:33 -0400)]
Fix compile warning with --cfg require_route_graph_test

3 years agoMerge pull request #872 from valentinewallace/timer-tick-in-bg-processor
Matt Corallo [Tue, 13 Apr 2021 01:37:52 +0000 (01:37 +0000)]
Merge pull request #872 from valentinewallace/timer-tick-in-bg-processor

Call timer_tick_occurred in BackgroundProcessor

3 years agoCall peer_manager.timer_tick_occurred() in background processor
Valentine Wallace [Fri, 9 Apr 2021 20:58:31 +0000 (16:58 -0400)]
Call peer_manager.timer_tick_occurred() in background processor

3 years agoRename timer_chan_freshness_every_min for uniformity with PeerManager
Valentine Wallace [Fri, 9 Apr 2021 20:55:10 +0000 (16:55 -0400)]
Rename timer_chan_freshness_every_min for uniformity with PeerManager

3 years agoMerge pull request #874 from TheBlueMatt/2021-04-persister-export
Matt Corallo [Mon, 12 Apr 2021 23:56:01 +0000 (23:56 +0000)]
Merge pull request #874 from TheBlueMatt/2021-04-persister-export

Prep lightning-persister for export in the C bindings

3 years agoImprove + fix indentation and style in lightning-persister 2021-04-persister-export
Matt Corallo [Mon, 12 Apr 2021 21:59:11 +0000 (17:59 -0400)]
Improve + fix indentation and style in lightning-persister

3 years agoReturn ChannelMonitors in a Vec, not HashMap when loading from disk
Matt Corallo [Mon, 12 Apr 2021 17:48:29 +0000 (13:48 -0400)]
Return ChannelMonitors in a Vec, not HashMap when loading from disk

There's little reason for the HashMap - the ChannelMonitors are
already unique (enforced by file names), and the eventual HashMap
that users need when deserializing the `ChannelManager` is a
slightly different form (it requires no BlockHash entry).

3 years agoFix benchmark compile warnings and errors
Matt Corallo [Mon, 12 Apr 2021 22:04:55 +0000 (18:04 -0400)]
Fix benchmark compile warnings and errors

Hopefully soon once a few more PRs get merged we can require this
in CI so we won't have any more regressions here.

3 years agoExpand persistence to all ChannelManagers, not just Arc-based ones
Matt Corallo [Mon, 12 Apr 2021 16:20:38 +0000 (12:20 -0400)]
Expand persistence to all ChannelManagers, not just Arc-based ones

3 years agoMerge pull request #856 from TheBlueMatt/2021-03-check-tx
Matt Corallo [Sat, 10 Apr 2021 20:27:24 +0000 (20:27 +0000)]
Merge pull request #856 from TheBlueMatt/2021-03-check-tx

Take the full funding transaction from the user on generation