]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
3 years agof - Add missing ChainPoller documentation
Jeffrey Czyz [Thu, 18 Feb 2021 20:52:25 +0000 (12:52 -0800)]
f - Add missing ChainPoller documentation

3 years agoAdd ChainPoller implementation of Poll trait
Jeffrey Czyz [Mon, 1 Feb 2021 07:43:43 +0000 (23:43 -0800)]
Add ChainPoller implementation of Poll trait

ChainPoller defines a strategy for polling a single BlockSource. It
handles validating chain data returned from the BlockSource. Thus, other
implementations of Poll must be defined in terms of ChainPoller.

3 years agof - Reduce Validate's visibility to pub(crate)
Jeffrey Czyz [Thu, 18 Feb 2021 20:30:07 +0000 (12:30 -0800)]
f - Reduce Validate's visibility to pub(crate)

3 years agof - Add TODO for using validate_pow result
Jeffrey Czyz [Thu, 18 Feb 2021 21:33:14 +0000 (13:33 -0800)]
f - Add TODO for using validate_pow result

3 years agoDefine a Poll trait as an adaptor on BlockSource
Jeffrey Czyz [Mon, 1 Feb 2021 07:42:27 +0000 (23:42 -0800)]
Define a Poll trait as an adaptor on BlockSource

SPV clients need to poll one or more block sources for the best chain
tip and to retrieve related chain data. The Poll trait serves as an
adaptor interface for BlockSource. Implementations may define an
appropriate polling strategy.

3 years agoMerge pull request #799 from TheBlueMatt/2021-02-chansigner-rename
Matt Corallo [Mon, 22 Feb 2021 16:44:00 +0000 (08:44 -0800)]
Merge pull request #799 from TheBlueMatt/2021-02-chansigner-rename

Rename ChannelKeys -> Sign and generic it consistently

3 years agoFurther rename `chan_keys` variables to `signers` 2021-02-chansigner-rename 2021-02-chansigner-util-fns
Matt Corallo [Sat, 20 Feb 2021 15:05:55 +0000 (10:05 -0500)]
Further rename `chan_keys` variables to `signers`

3 years agoUpdate C++ bindings demo with new struct naming
Matt Corallo [Fri, 19 Feb 2021 21:09:04 +0000 (16:09 -0500)]
Update C++ bindings demo with new struct naming

3 years agoUpdate auto-generated bindings
Matt Corallo [Fri, 19 Feb 2021 21:08:04 +0000 (16:08 -0500)]
Update auto-generated bindings

3 years agoUse ChannelSigner instead of ChanSigner for type parameters
Matt Corallo [Fri, 19 Feb 2021 02:05:47 +0000 (21:05 -0500)]
Use ChannelSigner instead of ChanSigner for type parameters

3 years agoChange Persist's Sign from an associated type to a generic param
Matt Corallo [Thu, 18 Feb 2021 21:20:43 +0000 (16:20 -0500)]
Change Persist's Sign from an associated type to a generic param

3 years agoUse `signer` instead of `keys_storage` in OnchainTx to hold `Sign`
Matt Corallo [Fri, 19 Feb 2021 02:32:58 +0000 (21:32 -0500)]
Use `signer` instead of `keys_storage` in OnchainTx to hold `Sign`

3 years agoRename ChannelKeys -> Sign and generic it consistently
Matt Corallo [Tue, 16 Feb 2021 21:30:08 +0000 (16:30 -0500)]
Rename ChannelKeys -> Sign and generic it consistently

The `ChannelKeys` object really isn't about keys at all anymore,
its all about signing. At the same time, we rename the type aliases
used in traits from both `ChanKeySigner` and `Keys` to just
`Signer` (or, in contexts where Channel isnt clear, `ChanSigner`).

3 years agoMerge pull request #801 from TheBlueMatt/2021-02-789-bindings
Matt Corallo [Fri, 19 Feb 2021 20:42:17 +0000 (12:42 -0800)]
Merge pull request #801 from TheBlueMatt/2021-02-789-bindings

Bindings updates for 789

3 years agoMerge pull request #752 from valentinewallace/chanman-persistence
Matt Corallo [Fri, 19 Feb 2021 20:37:24 +0000 (12:37 -0800)]
Merge pull request #752 from valentinewallace/chanman-persistence

ChannelManager persistence

3 years agoAdd BackgroundProcessor for ChannelManager persistence and other
Valentine Wallace [Mon, 11 Jan 2021 23:03:32 +0000 (18:03 -0500)]
Add BackgroundProcessor for ChannelManager persistence and other

Other includes calling timer_chan_freshness_every_minute() and in the
future, possibly persisting channel graph data.

This struct is suitable for things that need to happen periodically and
can happen in the background.

3 years agoAdd PersistenceNotifier to ChannelManager
Valentine Wallace [Thu, 19 Nov 2020 17:53:16 +0000 (12:53 -0500)]
Add PersistenceNotifier to ChannelManager

This will allow the ChannelManager to signal when it has new
updates to persist, and adds a way for ChannelManager persisters
to be notified when they should re-persist the ChannelManager
to disk/backups.

Feature-gate the wait_timeout function because the core
lightning crate shouldn't depend on wallclock time unless
users opt into it.

3 years agoFix Windows persistence
Valentine Wallace [Thu, 18 Feb 2021 20:45:47 +0000 (15:45 -0500)]
Fix Windows persistence

Windows started giving 'Access is denied' errors after
a few rounds of persistence. This seems to fix it.

3 years agoAbstract out disk-writing utilities from FilesystemPersister
Valentine Wallace [Thu, 19 Nov 2020 16:26:21 +0000 (11:26 -0500)]
Abstract out disk-writing utilities from FilesystemPersister

3 years agoMake logger macros public
Valentine Wallace [Wed, 2 Dec 2020 22:18:17 +0000 (17:18 -0500)]
Make logger macros public

These will be used in upcoming commits for the BackgroundProcessor
to log.

3 years agoMerge pull request #762 from valentinewallace/chan-reserve-fuzz-failure
Matt Corallo [Fri, 19 Feb 2021 19:57:46 +0000 (11:57 -0800)]
Merge pull request #762 from valentinewallace/chan-reserve-fuzz-failure

Don't include below-dust inbound HTLCs in commit tx fee calculation

3 years agoUpdate C bindings demos for new KeysManager API 2021-02-789-bindings
Matt Corallo [Fri, 19 Feb 2021 01:33:41 +0000 (20:33 -0500)]
Update C bindings demos for new KeysManager API

3 years ago- bindings updates
Matt Corallo [Fri, 19 Feb 2021 19:02:20 +0000 (14:02 -0500)]
- bindings updates

3 years ago[bindings] Handle unnamed enum variants
Matt Corallo [Fri, 19 Feb 2021 18:54:45 +0000 (13:54 -0500)]
[bindings] Handle unnamed enum variants

3 years agoAdd a no-bindings-map comment to `std::io::ErrorKind` in DecodeErr
Matt Corallo [Fri, 19 Feb 2021 18:55:15 +0000 (13:55 -0500)]
Add a no-bindings-map comment to `std::io::ErrorKind` in DecodeErr

3 years ago[bindings] Correctly use access string in to-Rust container conv
Matt Corallo [Fri, 19 Feb 2021 17:51:07 +0000 (12:51 -0500)]
[bindings] Correctly use access string in to-Rust container conv

`from_c_conversion_container_new_var` should use var_access when
it wishes to access the variable being converted, not `var_name`,
but in a few cases it did not. Note that this has no impact on the
generated bindings as of this commit.

3 years ago- bindings updates
Matt Corallo [Fri, 19 Feb 2021 19:01:10 +0000 (14:01 -0500)]
- bindings updates

3 years ago[bindings] Ensure owned objects in Vec conversion are marked `mut`
Matt Corallo [Fri, 19 Feb 2021 18:59:13 +0000 (13:59 -0500)]
[bindings] Ensure owned objects in Vec conversion are marked `mut`

3 years agoSwitch from slice to slice-of-refs for spend_spendable_outputs
Matt Corallo [Fri, 19 Feb 2021 18:08:54 +0000 (13:08 -0500)]
Switch from slice to slice-of-refs for spend_spendable_outputs

Sadly, there's just not really a practical way to map a slice of
objects in our current bindings infrastructure - either we take
ownership of the underlying objects and move them into a Vec, or we
need to leave the original objects in place and have a list of
pointers to the Rust objects. Thus, the only practical mapping is
to create a slice of references using the pointers we have.

3 years agoEnsure build_commitment_tx and next_local/remote_tx_fee agree on the fee
Valentine Wallace [Fri, 5 Feb 2021 18:09:23 +0000 (13:09 -0500)]
Ensure build_commitment_tx and next_local/remote_tx_fee agree on the fee

3 years agoDon't include below-dust inbound HTLCs in commit tx fee calculation
Valentine Wallace [Fri, 4 Dec 2020 21:05:10 +0000 (16:05 -0500)]
Don't include below-dust inbound HTLCs in commit tx fee calculation

Also remove part of the holding cell channel reserve test that's newly failing but
a bit of a redundant test anyway.

3 years agoMerge pull request #795 from TheBlueMatt/2021-02-features-bindings
Matt Corallo [Thu, 18 Feb 2021 17:54:59 +0000 (09:54 -0800)]
Merge pull request #795 from TheBlueMatt/2021-02-features-bindings

Map Features objects in bindings

3 years agoMerge pull request #789 from TheBlueMatt/2021-02-chansigner-util-fns
Matt Corallo [Thu, 18 Feb 2021 17:37:00 +0000 (09:37 -0800)]
Merge pull request #789 from TheBlueMatt/2021-02-chansigner-util-fns

Add util fn for creating a Transaction from spendable outputs

3 years agoUpdate auto-generated bindings 2021-02-features-bindings
Matt Corallo [Thu, 18 Feb 2021 17:31:29 +0000 (12:31 -0500)]
Update auto-generated bindings

3 years ago[bindings] Silence c-bindings-gen compile warnings
Matt Corallo [Thu, 11 Feb 2021 21:18:47 +0000 (16:18 -0500)]
[bindings] Silence c-bindings-gen compile warnings

3 years ago[bindings] Handle `impl Clone` like `impl ::core::clone::Clone`
Matt Corallo [Thu, 11 Feb 2021 21:14:58 +0000 (16:14 -0500)]
[bindings] Handle `impl Clone` like `impl ::core::clone::Clone`

3 years ago[bindings] Drop manual implementations of Features conversion
Matt Corallo [Thu, 11 Feb 2021 17:57:14 +0000 (12:57 -0500)]
[bindings] Drop manual implementations of Features conversion

We now handle features properly in our own resolution, and these
appear to be self-inconsistent in some cases.

3 years ago[bindings] Handle generic-ized impl blocks by concretizing them
Matt Corallo [Thu, 11 Feb 2021 16:47:51 +0000 (11:47 -0500)]
[bindings] Handle generic-ized impl blocks by concretizing them

This handles, for example, the `impl<X: Y> for Features<X>` blocks
which are generic across a number of different contexts. We do so
by walking the set of structs which alias Features and then walking
their generic arguments to check that they meet the bounds
specified in the impl block. For each alias which does, we create
a dummy, explicit, `impl XFeatures` block with the same content as
the original and recurse.

3 years ago[bindings] Resolve type aliases mapped as opaque types
Matt Corallo [Thu, 11 Feb 2021 16:39:21 +0000 (11:39 -0500)]
[bindings] Resolve type aliases mapped as opaque types

We already map type aliases which alias private types as opaque,
but we don't resolve them like we would any other opaque type,
preventing conversion printing or type use.

3 years ago[bindings] Track structs impling traits, incl priv traits
Matt Corallo [Thu, 11 Feb 2021 16:38:31 +0000 (11:38 -0500)]
[bindings] Track structs impling traits, incl priv traits

3 years ago[bindings] Allow resolution of private types in some cases
Matt Corallo [Thu, 11 Feb 2021 16:34:16 +0000 (11:34 -0500)]
[bindings] Allow resolution of private types in some cases

We need this specifically for resolving the
features::sealed::Context trait which is inside the non-pub
`sealed` module.

3 years agoDrop a useless import and use `Self` in return values in Features
Matt Corallo [Thu, 11 Feb 2021 15:23:41 +0000 (10:23 -0500)]
Drop a useless import and use `Self` in return values in Features

`Result` is in the standard prelude, so no need to ever use it.

Sadly, returning a Features<T> in the `impl Futures {}` block
will confuse our new alias-impl-printing logic, as we end up
running through the normal impl-block-printing logic as if we had
an explicit `impl ConcreteFeatures` block.

3 years ago[bindings] Use new ImportResolver during first AST pass
Matt Corallo [Tue, 9 Feb 2021 03:19:48 +0000 (22:19 -0500)]
[bindings] Use new ImportResolver during first AST pass

This removes some redundant logic and ensures we handle more
import-resolution cases in both contexts.

3 years ago[bindings] Track all declared types in ImportResolver construction
Matt Corallo [Tue, 9 Feb 2021 02:09:48 +0000 (21:09 -0500)]
[bindings] Track all declared types in ImportResolver construction

This allows an ImportResolver to handle more than imports, allowing
ident resolution of objects constructed in the same module.

3 years ago[bindings] Extract import resolution logic into a separate struct
Matt Corallo [Mon, 8 Feb 2021 21:14:53 +0000 (16:14 -0500)]
[bindings] Extract import resolution logic into a separate struct

This will allow us to reuse the same ident-resolution logic both
during the initial AST pass and during the second conversion pass.

3 years agoUpdate demo C++ bindings example for new bindings
Matt Corallo [Sun, 7 Feb 2021 05:58:49 +0000 (00:58 -0500)]
Update demo C++ bindings example for new bindings

3 years agoGen bindings with rustc --pretty=expanded instead of reading files
Matt Corallo [Sun, 7 Feb 2021 05:58:36 +0000 (00:58 -0500)]
Gen bindings with rustc --pretty=expanded instead of reading files

Instead of walking individual rust files and reading the AST from
those, we instead call
`RUSTC_BOOTSTRAP=1 cargo rustc --profile=check -- -Zunstable-options --pretty=expanded`
and let it create one giant lib.rs which we can parse as a whole.
This allows us to parse a post-macro crate, working with structs
and functions created inside macros just fine. It does require
handling a few things that we didn't previously, most notably Clone
via `impl ::core::clone::Clone` blocks instead of just looking for
`#![derive(Clone)]`.

This ends up resolving a few types slightly differently, resulting
in different bindings, but only in ways which don't impact the
runtime.

3 years ago[bindings] Use resolved, not local ident in generic mangling
Matt Corallo [Sat, 6 Feb 2021 04:26:53 +0000 (23:26 -0500)]
[bindings] Use resolved, not local ident in generic mangling

In traits with associated types which are returned in generics (ie
`trait T { type A: B; fn c() -> Result<Self::A, ()> {} }`), we
created a new generic mapping with the local type name (in this
case A) instead of using the real type (in this case B). This is
confusing as it results in generic manglings that don't reference
the real type (eg `LDKCResult_ChanKeySignerDecodeErrorZ`) and
may have multiple generic definitions that are identical.

Instead, we now use the final ident in the resolved mapping. The
biggest win is `LDKCResult_ChanKeySignerDecodeErrorZ` changing to
`CResult_ChannelKeysDecodeErrorZ`. However, there are several types
where `secp256k1::Error` was imported as `SecpError` and types like
`LDKCResult_SecretKeySecpErrorZ` are now
`LDKCResult_SecretKeyErrorZ` instead. Still, the type of the error
field remains `LDKSecp256k1Error`, which should avoid any confusion.

3 years ago[bindings] Drop some significantly-overly-verbose logging in gen
Matt Corallo [Mon, 26 Oct 2020 02:49:05 +0000 (22:49 -0400)]
[bindings] Drop some significantly-overly-verbose logging in gen

3 years agoRename output descriptor types for some clarity
Matt Corallo [Tue, 16 Feb 2021 21:15:40 +0000 (16:15 -0500)]
Rename output descriptor types for some clarity

Both Miron and Val suggested naming tweaks in their reviews, so
clarifying things some would be good.

3 years agoClarify docs on revocation_pubkey in DynamicP2WSHOutputDescriptor
Matt Corallo [Mon, 8 Feb 2021 17:15:25 +0000 (12:15 -0500)]
Clarify docs on revocation_pubkey in DynamicP2WSHOutputDescriptor

3 years agoDrop stale and cleanup TODO entries in keysinterface
Matt Corallo [Thu, 4 Feb 2021 00:56:43 +0000 (19:56 -0500)]
Drop stale and cleanup TODO entries in keysinterface

3 years agoSwitch to calling new KeysManager output-spending fn in tests
Matt Corallo [Sat, 6 Feb 2021 18:32:53 +0000 (13:32 -0500)]
Switch to calling new KeysManager output-spending fn in tests

3 years agoAdd util fn for creating a Transaction from spendable outputs
Matt Corallo [Thu, 4 Feb 2021 00:47:36 +0000 (19:47 -0500)]
Add util fn for creating a Transaction from spendable outputs

This adds a utility method, `KeysManager::spend_spendable_outputs`,
which constructs a Transaction from a given set of
`SpendableOutputDescriptor`s, deriving relevant keys as needed.

It also adds methods which can sign individual inputs where
channel-specific key derivation is required to
`InMemoryChannelKeys`, making it easy to sign transaction inputs
when a custom `KeysInterface` is used with `InMemoryChannelKeys`.

3 years agoAdd utility function to add a change output to a transaction
Matt Corallo [Fri, 5 Feb 2021 19:49:13 +0000 (14:49 -0500)]
Add utility function to add a change output to a transaction

3 years agoDrop dup txn in test_dynamic_spendable_outputs_local_htlc_success_tx
Matt Corallo [Thu, 4 Feb 2021 00:45:23 +0000 (19:45 -0500)]
Drop dup txn in test_dynamic_spendable_outputs_local_htlc_success_tx

Previously, test_dynamic_spendable_outputs_local_htlc_success_tx
called connect_block with two identical transactions, which
resulted in duplicate SpendableOutputs Events back-to-back. This
is a test issue as such a block_connected call represents an
invalid block.

3 years agoDrop unused Network argument to KeysManager::new().
Matt Corallo [Wed, 3 Feb 2021 04:23:25 +0000 (23:23 -0500)]
Drop unused Network argument to KeysManager::new().

KeyManager::new() took a bitcoin::Network parameter which needs to
be passed to the BIP 32 Extended Key constructor, but because we
never write out the BIP 32 serialization, it isn't used. Instead,
we just pass a dummy value into `ExtendedPrivKey`, dropping the
unused argument to KeysManager::new().

3 years agof fix typos val caught
Matt Corallo [Tue, 16 Feb 2021 20:57:03 +0000 (15:57 -0500)]
f fix typos val caught

3 years agoStruct-ify SpendableOutputDescriptor entries relevant to channels
Matt Corallo [Wed, 3 Feb 2021 03:47:09 +0000 (22:47 -0500)]
Struct-ify SpendableOutputDescriptor entries relevant to channels

Both SpendableOutputDescriptor::DynamicOutputP2WSH and
SpendableOutputDescriptor::StaticOutputCounterpartyPayment are
relevant only in the context of a given channel, making them
candidates for being passed into helper functions in
`InMemoryChannelKeys`. This moves them into their own structs so
that they can later be used standalone.

3 years ago[tests] Correct witness len calc in StaticOutputCounterpartyPayment
Matt Corallo [Wed, 3 Feb 2021 03:45:53 +0000 (22:45 -0500)]
[tests] Correct witness len calc in StaticOutputCounterpartyPayment

We previously counted 35 bytes for a length + public key, but in
reality they are never larger than 34 bytes - 33 for the key and 1
for the push length.

3 years agoMerge pull request #786 from TheBlueMatt/2021-02-chansigner-util
Matt Corallo [Tue, 16 Feb 2021 17:33:37 +0000 (09:33 -0800)]
Merge pull request #786 from TheBlueMatt/2021-02-chansigner-util

Expand documentation and fields in SpendableOutputDescriptors

3 years agoMerge pull request #797 from TheBlueMatt/2021-02-no-addr-order
Matt Corallo [Tue, 16 Feb 2021 16:05:26 +0000 (08:05 -0800)]
Merge pull request #797 from TheBlueMatt/2021-02-no-addr-order

Drop address ordering enforcement in NodeAnnouncement deser

3 years agoMerge pull request #798 from TheBlueMatt/2021-02-route-bench
Matt Corallo [Mon, 15 Feb 2021 23:32:10 +0000 (15:32 -0800)]
Merge pull request #798 from TheBlueMatt/2021-02-route-bench

3 years agoFetch network graph cache and run benchmarks on CI 2021-02-route-bench
Matt Corallo [Mon, 15 Feb 2021 21:49:44 +0000 (16:49 -0500)]
Fetch network graph cache and run benchmarks on CI

3 years agoAdd a trivial benchmark of calculating routes on today's graph
Matt Corallo [Mon, 15 Feb 2021 21:49:02 +0000 (16:49 -0500)]
Add a trivial benchmark of calculating routes on today's graph

Sadly rust upstream never really figured out the benchmark story,
and it looks like the API we use here may not be long for this
world. Luckily, we can switch to criterion with largely the same
API if that happens before upstream finishes ongoing work with the
custom test framework stuff.

Sadly, it requires fetching the current network graph, which I did
using Val's route-testing script written to test the MPP router.

3 years agoAllow gossip messages to have 1KB of uninterpreted data and relay 2021-02-no-addr-order
Matt Corallo [Mon, 15 Feb 2021 20:25:37 +0000 (15:25 -0500)]
Allow gossip messages to have 1KB of uninterpreted data and relay

3 years agoDrop trailing semicolons which rustc nightly generates warnings for
Matt Corallo [Fri, 12 Feb 2021 21:06:14 +0000 (16:06 -0500)]
Drop trailing semicolons which rustc nightly generates warnings for

3 years agoAdapt C++ bindings demo to new API and keys (new funding tx) 2021-02-chansigner-util
Matt Corallo [Sat, 6 Feb 2021 19:06:07 +0000 (14:06 -0500)]
Adapt C++ bindings demo to new API and keys (new funding tx)

3 years agoUpdate auto-generated bindings
Matt Corallo [Fri, 12 Feb 2021 23:58:59 +0000 (18:58 -0500)]
Update auto-generated bindings

3 years agoSlightly expand documentation on KeysInterface
Matt Corallo [Tue, 2 Feb 2021 21:40:59 +0000 (16:40 -0500)]
Slightly expand documentation on KeysInterface

Specifically, this notes when methods can or can not return the
same value on each call.

3 years agoExpand documentation and fields in SpendableOutputDescriptors
Matt Corallo [Sat, 6 Feb 2021 18:19:40 +0000 (13:19 -0500)]
Expand documentation and fields in SpendableOutputDescriptors

This adds a channel_value_satoshis field to
SpendableOutputDescriptors as it is required to recreate our
InMemoryChannelKeys. It also slightly expands documentation.

3 years agoSwap key_derivation_params (u64, u64) for channel_keys_id [u8; 32]
Matt Corallo [Sat, 6 Feb 2021 18:11:23 +0000 (13:11 -0500)]
Swap key_derivation_params (u64, u64) for channel_keys_id [u8; 32]

Instead of `key_derivation_params` being a rather strange type, we
call it `channel_keys_id` and give it a generic 32 byte array. This
should be much clearer for users and also more flexible.

3 years agoDrop address ordering enforcement in NodeAnnouncement deser
Matt Corallo [Fri, 12 Feb 2021 18:05:59 +0000 (13:05 -0500)]
Drop address ordering enforcement in NodeAnnouncement deser

It seems many other nodes never bothered to enforce these
requirements, so there's little reason that we should either.

cc https://github.com/lightningnetwork/lightning-rfc/pull/842

3 years agoMerge pull request #788 from TheBlueMatt/2020-02-concrete-bindings
Matt Corallo [Thu, 11 Feb 2021 04:31:43 +0000 (20:31 -0800)]
Merge pull request #788 from TheBlueMatt/2020-02-concrete-bindings

Concretize bindings templates

3 years agoUpdate auto-generated bindings 2020-02-concrete-bindings
Matt Corallo [Thu, 11 Feb 2021 03:25:47 +0000 (22:25 -0500)]
Update auto-generated bindings

3 years agoAdd additional Clone derives
Matt Corallo [Thu, 11 Feb 2021 03:25:42 +0000 (22:25 -0500)]
Add additional Clone derives

The only API change outside of additional derives is to change
the inner field in `DecodeError::Io()` to an `std::io::ErrorKind`
instead of an `std::io::Error`. While `std::io::Error` obviously
makes more sense in context, it doesn't support Clone, and the
inner error largely doesn't have a lot of value on its own.

3 years ago[bindings] Allow cloning opaque types when inner is NULL
Matt Corallo [Sat, 30 Jan 2021 22:15:22 +0000 (17:15 -0500)]
[bindings] Allow cloning opaque types when inner is NULL

Previously we'd segfault trying to deref the NULL page, but there
is no reason to not simply clone by creating another opaque instance
with a null inner. This comes up specifically when cloning
ChannelSigners as the pubkeys instance is NULL on construction
before get_pubkeys is called.

3 years ago[C++ bindings] Update demo app due to removed TupleTempl generics
Matt Corallo [Tue, 5 Jan 2021 02:08:53 +0000 (21:08 -0500)]
[C++ bindings] Update demo app due to removed TupleTempl generics

3 years ago[bindings] Drop some stale code from bindings generic generation
Matt Corallo [Tue, 5 Jan 2021 01:58:58 +0000 (20:58 -0500)]
[bindings] Drop some stale code from bindings generic generation

3 years ago[bindings] Move to manual write-out for Tuples, too
Matt Corallo [Wed, 3 Feb 2021 23:14:39 +0000 (18:14 -0500)]
[bindings] Move to manual write-out for Tuples, too

3 years ago[bindings] Move to manual write-out for Vec, too
Matt Corallo [Tue, 5 Jan 2021 00:26:12 +0000 (19:26 -0500)]
[bindings] Move to manual write-out for Vec, too

3 years ago[bindings] Concretize Result types without type aliasing
Matt Corallo [Mon, 4 Jan 2021 22:29:25 +0000 (17:29 -0500)]
[bindings] Concretize Result types without type aliasing

While the type aliasing trick works great for cbindgen,
wasm_bindgen doesn't support it and requires fully-concrete types.
In order to better support wasm_bindgen in the future, we do so
here, adding a function which manually writes out almost the exact
thing which was templated previously in concrete form.

As a nice side-effect, we no longer have to allocate and free a u8
for generic parameters which were `()` (though we still do in some
conversion functions, which we can get rid of when we similarly
concretize all generics fully).

3 years ago[bindings] Keep track of all types which derive[Clone]
Matt Corallo [Wed, 3 Feb 2021 22:46:29 +0000 (17:46 -0500)]
[bindings] Keep track of all types which derive[Clone]

3 years ago[bindings] Add additional clone methods on manually-defined types
Matt Corallo [Sat, 30 Jan 2021 22:19:33 +0000 (17:19 -0500)]
[bindings] Add additional clone methods on manually-defined types

3 years agoMerge pull request #787 from TheBlueMatt/2021-02-check-close-source
Matt Corallo [Wed, 10 Feb 2021 17:09:53 +0000 (09:09 -0800)]
Merge pull request #787 from TheBlueMatt/2021-02-check-close-source

3 years agoFix documentation on PeerHandleError 2021-02-check-close-source
Matt Corallo [Mon, 1 Feb 2021 01:53:28 +0000 (20:53 -0500)]
Fix documentation on PeerHandleError

3 years agoAdd test for error message hangline resulting in force-close
Matt Corallo [Sun, 7 Feb 2021 23:49:48 +0000 (18:49 -0500)]
Add test for error message hangline resulting in force-close

3 years agoCheck the PK of the source of an error before closing chans from it
Matt Corallo [Sat, 16 Jan 2021 02:34:17 +0000 (21:34 -0500)]
Check the PK of the source of an error before closing chans from it

When we receive an error message from a peer, it can indicate a
channel which we should close. However, we previously did not
check that the counterparty who sends us such a message is the
counterparty with whom we have the channel, allowing any
connected peer to make us force-close any channel we have as long
as they know the channel id.

This commit simply changes the force-close logic to check that the
sender matches the channel's counterparty node_id, though as noted
in #105, we eventually need to change the indexing anyway to allow
absurdly terrible peers to open channels with us.

Found during review of #777.

3 years agoMerge pull request #793 from galderz/t_double_validation_792
Matt Corallo [Fri, 5 Feb 2021 14:17:46 +0000 (06:17 -0800)]
Merge pull request #793 from galderz/t_double_validation_792

3 years agoUnknown bits feature only needs to be validated once #792
Galder Zamarreño [Fri, 5 Feb 2021 12:29:56 +0000 (13:29 +0100)]
Unknown bits feature only needs to be validated once #792

3 years agoMerge pull request #790 from bmancini55/sync_complete
Matt Corallo [Thu, 4 Feb 2021 17:18:52 +0000 (09:18 -0800)]
Merge pull request #790 from bmancini55/sync_complete

Interpret sync_complete in reply_channel_range

3 years agoMerge pull request #774 from jkczyz/2021-01-http-client
Matt Corallo [Thu, 4 Feb 2021 17:16:14 +0000 (09:16 -0800)]
Merge pull request #774 from jkczyz/2021-01-http-client

HTTP-based block source clients

3 years agoImplement BlockSource for REST and RPC clients
Jeffrey Czyz [Tue, 12 Jan 2021 07:33:42 +0000 (23:33 -0800)]
Implement BlockSource for REST and RPC clients

Interprets HTTP responses as either binary or JSON format, which are
then converted to the appropriate data types.

3 years agoAdd REST and RPC clients to lightning-block-sync
Jeffrey Czyz [Tue, 12 Jan 2021 00:07:47 +0000 (16:07 -0800)]
Add REST and RPC clients to lightning-block-sync

Implements a simple HTTP client that can issue GET and POST requests.
Used to implement REST and RPC clients, respectively. Both clients
support either blocking or non-blocking I/O.

3 years agoInterpret sync_complete in reply_channel_range
bmancini55 [Wed, 3 Feb 2021 16:34:48 +0000 (11:34 -0500)]
Interpret sync_complete in reply_channel_range

LN Spec PR #826 changes full_information to indicate completion of a
sequence of reply_channel_range messages.

3 years agoAdd lightning-block-sync package and library
Jeffrey Czyz [Mon, 11 Jan 2021 18:50:54 +0000 (10:50 -0800)]
Add lightning-block-sync package and library

Defines an interface and related types for fetching block headers and
data from a block source (e.g., Bitcoin Core). Used to keep lightning in
sync with chain activity.

3 years agoMerge pull request #768 from TheBlueMatt/2020-12-chanman-bindings-deser
Matt Corallo [Wed, 3 Feb 2021 15:43:34 +0000 (07:43 -0800)]
Merge pull request #768 from TheBlueMatt/2020-12-chanman-bindings-deser

Expose ChannelManager/Monitor read methods in bindings

3 years ago[bindings] Fix genbindings.sh compile issues on OSX 2020-12-chanman-bindings-deser
Matt Corallo [Wed, 3 Feb 2021 00:28:40 +0000 (19:28 -0500)]
[bindings] Fix genbindings.sh compile issues on OSX

There were two issues on OSX - we need to give gcc the clang
warnings flags because `gcc` *is* clang on OSX and we missed an
`-std=c++11` on one of the clang++ calls, causing compile failures.

3 years agoUpdate C++ bindings demo to use `ChannelManager` de/serialization
Matt Corallo [Thu, 31 Dec 2020 22:48:55 +0000 (17:48 -0500)]
Update C++ bindings demo to use `ChannelManager` de/serialization

This demonstrates (and tests) the newly-exposed `ChannelManager`
de/serialization functions. Best revewied with -b --color-moved.

3 years ago[C++ bindings demo] Add now-missing std::moves
Matt Corallo [Thu, 31 Dec 2020 21:45:55 +0000 (16:45 -0500)]
[C++ bindings demo] Add now-missing std::moves