Commit graph

119 commits

Author SHA1 Message Date
Valentine Wallace
7c8e740b6e Change ChannelMonitor deserialization to return an optional blockhash.
See previous commit msg for details.
2021-03-02 14:30:56 -05:00
Matt Corallo
9fba7c92ad
Merge pull request #802 from TheBlueMatt/2021-01-update-rust-bitcoin
Update rust-bitcoin and add secp256k1 context randomization
2021-02-28 16:43:08 -08:00
Matt Corallo
a51d5cef58 Update rust-bitcoin 2021-02-26 15:15:18 -05:00
Valentine Wallace
bfaec717ae
persist: Persist ChannelMonitors in their own directory. 2021-02-26 12:38:47 -05:00
Matt Corallo
aa127f55ed Use ChannelSigner instead of ChanSigner for type parameters 2021-02-19 16:04:19 -05:00
Matt Corallo
523fcb6f3f Change Persist's Sign from an associated type to a generic param 2021-02-19 16:04:19 -05:00
Matt Corallo
ff00f6f886 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`).
2021-02-19 15:54:41 -05:00
Valentine Wallace
a368093803
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.
2021-02-19 15:00:43 -05:00
Valentine Wallace
a88dfbfcca
Fix Windows persistence
Windows started giving 'Access is denied' errors after
a few rounds of persistence. This seems to fix it.
2021-02-19 15:00:43 -05:00
Valentine Wallace
36eaccc607
Abstract out disk-writing utilities from FilesystemPersister 2021-02-19 15:00:43 -05:00
Matt Corallo
f151c02975
Merge pull request #764 from lightning-signer/revoke-enforcement
Revocation enforcement
2021-01-25 09:06:43 -08:00
Sergi Delgado Segura
821f6cdd1e
Makes ChannelManager::force_close_channel fail for unknown chan_ids
ChannelManager::force_close_channel does not fail if a non-existing channel id is being passed, making it hard to catch from an API point of view.

Makes force_close_channel return in the same way close_channel does so the user calling the method with an unknown id can be warned.
2021-01-21 16:12:57 +01:00
Devrandom
2cbb8358f1 Use TestKeysInterface in functional tests
This allows stateful validation in EnforcingChannelKeys
2021-01-18 11:59:39 -08:00
Matt Corallo
990d1de99a Use KeysInterface::read_chan_signer for all channel keys deser
This drops any direct calls to a generic `ChannelKeys::read()` and
replaces it with the new `KeysInterface::read_chan_signer()`. Still,
under the hood all of our own `KeysInterface::read_chan_signer()`
implementations simply call out to a `Readable::read()` implemention.
2021-01-04 12:40:40 -05:00
Matt Corallo
0f5580afd4 Use Writeable for ChannelMonitor instead of a specific function.
There's no reason to have ChannelMonitor::write_for_disk instead of
just using the Writeable trait anymore. Previously, it was used to
differentiate with `write_for_watchtower`, but support for
watchtower-mode ChannelMonitors was never completed and the partial
bits were removed long ago.

This has the nice benefit of hitting the custom Writeable codepaths
in C bindings instead of trying to hit trait-generics paths.
2021-01-04 12:40:40 -05:00
Matt Corallo
4345aa88ae Universally Require Writeable for ChannelKeys
It doesn't make sense to ever build a lightning node which doesn't
ever write ChannelMonitors to disk, so having a ChannelKeys object
which doesn't implement Writeable is nonsense.

Here we require Writeable for all ChannelKeys objects, simplifying
code generation for C bindings somewhat.
2021-01-04 12:40:40 -05:00
Matt Corallo
4aa8e9cda7 Bump version to 0.0.12 2020-11-24 16:35:20 -05:00
Valentine Wallace
fc68afb21b
Rename ChannelMonitor::write_for_disk --> serialize_for_disk
This function does not necessarily write to disk, it can serialize to anything
that implements Writer.
2020-10-16 13:41:39 -04:00
Valentine Wallace
82f5a1cbda
Add a sample module FilesystemPersister.
Intended to be a cross-platform implementation of the
channelmonitor::Persist trait.

This adds a new lightning-persister crate, that uses the
newly exposed lightning crate's test utilities.

Notably, this crate is pretty small right now. However, due to
future plans to add more data persistence (e.g. persisting the
ChannelManager, etc) and a desire to avoid pulling in filesystem
usage into the core lightning package, it is best for it to be
separated out.

Note: Windows necessitates the use of OpenOptions with the `write`
permission enabled to `sync_all` on a newly opened channel's
data file.
2020-10-16 13:41:36 -04:00