projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #2861 from tnull/2024-01-introduce-cargo-audit
[rust-lightning]
/
lightning
/
src
/
util
/
scid_utils.rs
diff --git
a/lightning/src/util/scid_utils.rs
b/lightning/src/util/scid_utils.rs
index fbbcc69a133e0966e8bd937d1838ac8dc4fd5c17..9d943b4d466e5af801607d64f5687e4395588bb9 100644
(file)
--- a/
lightning/src/util/scid_utils.rs
+++ b/
lightning/src/util/scid_utils.rs
@@
-7,6
+7,8
@@
// You may not use this file except in accordance with one or both of these
// licenses.
// You may not use this file except in accordance with one or both of these
// licenses.
+//! Utilities for creating and parsing short channel ids.
+
/// Maximum block height that can be used in a `short_channel_id`. This
/// value is based on the 3-bytes available for block height.
pub const MAX_SCID_BLOCK: u64 = 0x00ffffff;
/// Maximum block height that can be used in a `short_channel_id`. This
/// value is based on the 3-bytes available for block height.
pub const MAX_SCID_BLOCK: u64 = 0x00ffffff;
@@
-22,8
+24,11
@@
pub const MAX_SCID_VOUT_INDEX: u64 = 0xffff;
/// A `short_channel_id` construction error
#[derive(Debug, PartialEq, Eq)]
pub enum ShortChannelIdError {
/// A `short_channel_id` construction error
#[derive(Debug, PartialEq, Eq)]
pub enum ShortChannelIdError {
+ /// Block height too high
BlockOverflow,
BlockOverflow,
+ /// Tx index too high
TxIndexOverflow,
TxIndexOverflow,
+ /// Vout index too high
VoutIndexOverflow,
}
VoutIndexOverflow,
}
@@
-69,7
+74,7
@@
pub(crate) mod fake_scid {
use bitcoin::blockdata::constants::ChainHash;
use bitcoin::network::constants::Network;
use crate::sign::EntropySource;
use bitcoin::blockdata::constants::ChainHash;
use bitcoin::network::constants::Network;
use crate::sign::EntropySource;
- use crate::
util
::chacha20::ChaCha20;
+ use crate::
crypto
::chacha20::ChaCha20;
use crate::util::scid_utils;
use core::convert::TryInto;
use crate::util::scid_utils;
use core::convert::TryInto;
@@
-91,8
+96,11
@@
pub(crate) mod fake_scid {
/// into the fake scid.
#[derive(Copy, Clone)]
pub(crate) enum Namespace {
/// into the fake scid.
#[derive(Copy, Clone)]
pub(crate) enum Namespace {
+ /// Phantom nodes namespace
Phantom,
Phantom,
+ /// SCID aliases for outbound private channels
OutboundAlias,
OutboundAlias,
+ /// Payment interception namespace
Intercept
}
Intercept
}