2020-08-10 15:00:09 -04:00
|
|
|
// This file is Copyright its original authors, visible in version control
|
|
|
|
// history.
|
|
|
|
//
|
|
|
|
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
|
|
|
|
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
|
|
|
|
// You may not use this file except in accordance with one or both of these
|
|
|
|
// licenses.
|
|
|
|
|
2018-09-19 17:39:43 -04:00
|
|
|
//! Some utility modules live here. See individual sub-modules for more info.
|
|
|
|
|
Batch-sign local HTLC txn with a well-doc'd API, returning sigs
1107ab06c33bd360bdee7ee64f4b690e753003f6 introduced an API to have a
ChannelKeys implementer sign HTLC transactions by calling into the
LocalCommitmentTransaction object, which would then store the tx.
This API was incredibly awkward, both because it required an
external signer trust our own internal interfaces, but also because
it didn't allow for any inspection of what was about to be signed.
Further, it signed the HTLC transactions one-by-one in a somewhat
inefficient way, and there isn't a clear way to resolve this (as
the which-HTLC parameter has to refer to something in between the
HTLC's arbitrary index, and its index in the commitment tx, which
has "holes" for the non-HTLC outputs and skips some HTLCs).
We replace it with a new function in ChannelKeys which allows us
to sign all HTLCs in a given commitment transaction (which allows
for a bit more effeciency on the signers' part, as well as
sidesteps the which-HTLC issue). This may also simplify the signer
implementation as we will always want to sign all HTLCs spending a
given commitment transaction at once anyway.
We also de-mut the LocalCommitmentTransaction passed to the
ChanKeys, instead opting to make LocalCommitmentTransaction const
and avoid storing any new HTLC-related data in it.
2020-04-19 22:59:53 -04:00
|
|
|
#[macro_use]
|
|
|
|
pub(crate) mod fuzz_wrappers;
|
|
|
|
|
2021-05-31 16:46:34 +00:00
|
|
|
#[macro_use]
|
|
|
|
pub(crate) mod ser_macros;
|
|
|
|
|
2017-12-25 01:05:27 -05:00
|
|
|
pub mod events;
|
2018-08-17 12:46:17 +09:00
|
|
|
pub mod errors;
|
2018-09-14 16:43:47 -04:00
|
|
|
pub mod ser;
|
2021-03-16 15:55:44 +01:00
|
|
|
pub mod message_signing;
|
2022-01-21 11:33:39 +01:00
|
|
|
pub mod invoice;
|
2022-04-11 13:50:31 -04:00
|
|
|
pub mod persist;
|
2017-12-25 01:05:27 -05:00
|
|
|
|
2021-10-08 22:54:32 +00:00
|
|
|
pub(crate) mod atomic_counter;
|
2018-02-24 19:59:59 -05:00
|
|
|
pub(crate) mod byte_utils;
|
2018-12-13 17:18:31 -05:00
|
|
|
pub(crate) mod chacha20;
|
2022-05-13 18:03:51 +02:00
|
|
|
#[cfg(all(not(test), feature = "std"))]
|
2021-10-06 16:58:56 +00:00
|
|
|
pub(crate) mod fairrwlock;
|
2022-02-17 19:29:59 +00:00
|
|
|
#[cfg(fuzzing)]
|
2021-03-31 11:38:31 +02:00
|
|
|
pub mod zbase32;
|
2022-02-17 19:29:59 +00:00
|
|
|
#[cfg(not(fuzzing))]
|
2021-03-31 11:38:31 +02:00
|
|
|
pub(crate) mod zbase32;
|
2022-02-17 19:29:59 +00:00
|
|
|
#[cfg(not(fuzzing))]
|
2018-12-14 13:29:55 -05:00
|
|
|
pub(crate) mod poly1305;
|
2018-02-24 19:59:59 -05:00
|
|
|
pub(crate) mod chacha20poly1305rfc;
|
2018-07-19 22:54:20 -04:00
|
|
|
pub(crate) mod transaction_utils;
|
2021-03-03 16:46:55 -05:00
|
|
|
pub(crate) mod scid_utils;
|
2017-12-25 01:05:27 -05:00
|
|
|
|
2020-12-02 17:18:17 -05:00
|
|
|
/// Logging macro utilities.
|
2018-09-14 16:43:47 -04:00
|
|
|
#[macro_use]
|
2021-03-07 16:24:05 -05:00
|
|
|
pub(crate) mod macro_logger;
|
2018-09-14 16:43:47 -04:00
|
|
|
|
2022-01-27 13:40:30 -05:00
|
|
|
/// Cryptography utilities.
|
|
|
|
pub(crate) mod crypto;
|
|
|
|
|
2018-10-31 14:51:39 -04:00
|
|
|
// These have to come after macro_logger to build
|
2018-09-14 16:43:47 -04:00
|
|
|
pub mod logger;
|
2018-10-31 14:51:39 -04:00
|
|
|
pub mod config;
|
2018-09-14 16:43:47 -04:00
|
|
|
|
2022-02-17 19:29:59 +00:00
|
|
|
#[cfg(any(test, fuzzing, feature = "_test_utils"))]
|
2020-09-16 17:27:13 -04:00
|
|
|
pub mod test_utils;
|
2019-01-17 17:36:49 -05:00
|
|
|
|
2019-11-26 16:46:33 -05:00
|
|
|
/// impls of traits that add exra enforcement on the way they're called. Useful for detecting state
|
|
|
|
/// machine errors and used in fuzz targets and tests.
|
2022-02-17 19:29:59 +00:00
|
|
|
#[cfg(any(test, fuzzing, feature = "_test_utils"))]
|
2019-11-26 16:46:33 -05:00
|
|
|
pub mod enforcing_trait_impls;
|
2022-01-27 13:40:30 -05:00
|
|
|
|