projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix unknown handling in `impl_writeable_tlv_based_enum_upgradable`
[rust-lightning]
/
lightning
/
src
/
ln
/
channel_id.rs
diff --git
a/lightning/src/ln/channel_id.rs
b/lightning/src/ln/channel_id.rs
index 621ebf0c460333446e22d2a28bd7bdc4b724dae8..8df6d75ef5e80b4d4acb2cb39b2358be9c638131 100644
(file)
--- a/
lightning/src/ln/channel_id.rs
+++ b/
lightning/src/ln/channel_id.rs
@@
-13,15
+13,14
@@
use crate::ln::msgs::DecodeError;
use crate::sign::EntropySource;
use crate::util::ser::{Readable, Writeable, Writer};
use crate::sign::EntropySource;
use crate::util::ser::{Readable, Writeable, Writer};
-use bitcoin::hashes::hex::ToHex;
-
use crate::io;
use crate::io;
-use crate::prelude::*;
use core::fmt;
use core::ops::Deref;
/// A unique 32-byte identifier for a channel.
use core::fmt;
use core::ops::Deref;
/// A unique 32-byte identifier for a channel.
-/// Depending on how the ID is generated, several varieties are distinguished (but all are stored as 32 bytes): _v1_ and _temporary_.
+/// Depending on how the ID is generated, several varieties are distinguished
+/// (but all are stored as 32 bytes):
+/// _v1_ and _temporary_.
/// A _v1_ channel ID is generated based on funding tx outpoint (txid & index).
/// A _temporary_ ID is generated randomly.
/// (Later revocation-point-based _v2_ is a possibility.)
/// A _v1_ channel ID is generated based on funding tx outpoint (txid & index).
/// A _temporary_ ID is generated randomly.
/// (Later revocation-point-based _v2_ is a possibility.)
@@
-77,12
+76,6
@@
impl Readable for ChannelId {
}
}
}
}
-impl ToHex for ChannelId {
- fn to_hex(&self) -> String {
- self.0.to_hex()
- }
-}
-
impl fmt::Display for ChannelId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
crate::util::logger::DebugBytes(&self.0).fmt(f)
impl fmt::Display for ChannelId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
crate::util::logger::DebugBytes(&self.0).fmt(f)
@@
-91,17
+84,18
@@
impl fmt::Display for ChannelId {
#[cfg(test)]
mod tests {
#[cfg(test)]
mod tests {
+ use hex::DisplayHex;
+
use crate::ln::ChannelId;
use crate::util::ser::{Readable, Writeable};
use crate::util::test_utils;
use crate::ln::ChannelId;
use crate::util::ser::{Readable, Writeable};
use crate::util::test_utils;
- use bitcoin::hashes::hex::ToHex;
use crate::prelude::*;
use crate::io;
#[test]
fn test_channel_id_v1_from_funding_txid() {
let channel_id = ChannelId::v1_from_funding_txid(&[2; 32], 1);
use crate::prelude::*;
use crate::io;
#[test]
fn test_channel_id_v1_from_funding_txid() {
let channel_id = ChannelId::v1_from_funding_txid(&[2; 32], 1);
- assert_eq!(channel_id.
to_hex
(), "0202020202020202020202020202020202020202020202020202020202020203");
+ assert_eq!(channel_id.
0.as_hex().to_string
(), "0202020202020202020202020202020202020202020202020202020202020203");
}
#[test]
}
#[test]