Skip to content

Commit d0fb613

Browse files
authored
Merge pull request #79 from NishantBansal2003/bitcoin-txid
smite: use `bitcoin::Txid` instead of local newtype
2 parents ff61229 + 608e5c6 commit d0fb613

5 files changed

Lines changed: 8 additions & 11 deletions

File tree

smite/src/bolt.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub use tx_remove_input::TxRemoveInput;
6161
pub use tx_remove_output::TxRemoveOutput;
6262
pub use types::{
6363
BigSize, CHANNEL_ID_SIZE, COMPACT_SIGNATURE_SIZE, ChannelId, MAX_MESSAGE_SIZE, PUBLIC_KEY_SIZE,
64-
SHA256_HASH_SIZE, TXID_SIZE, Txid,
64+
SHA256_HASH_SIZE, TXID_SIZE,
6565
};
6666
pub use update_fail_htlc::{UpdateFailHtlc, UpdateFailHtlcTlvs};
6767
pub use update_fail_malformed_htlc::UpdateFailMalformedHtlc;
@@ -362,6 +362,7 @@ pub fn message_with_type(msg_type: u16, payload: &[u8]) -> Vec<u8> {
362362
#[cfg(test)]
363363
mod tests {
364364
use super::*;
365+
use bitcoin::Txid;
365366
use bitcoin::hashes::{Hash, sha256};
366367
use bitcoin::secp256k1::{self, PublicKey, Secp256k1, SecretKey};
367368
use types::CHAIN_HASH_SIZE;

smite/src/bolt/funding_created.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! BOLT 2 funding created message.
22
33
use super::BoltError;
4-
use super::types::{ChannelId, Txid};
4+
use super::types::ChannelId;
55
use super::wire::WireFormat;
6+
use bitcoin::Txid;
67
use bitcoin::secp256k1::ecdsa::Signature;
78

89
/// BOLT 2 `funding_created` message (type 34).

smite/src/bolt/tx_add_input.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
//! BOLT 2 `tx_add_input` message.
22
3+
use bitcoin::Txid;
34
use bitcoin::secp256k1::hashes::Hash;
45

56
use super::BoltError;
67
use super::tlv::TlvStream;
7-
use super::types::{ChannelId, Txid};
8+
use super::types::ChannelId;
89
use super::wire::WireFormat;
910

1011
/// BOLT 2 `tx_add_input` message (type 66).

smite/src/bolt/types.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Fundamental types for BOLT message encoding.
22
3-
use bitcoin::hashes::{self, sha256d};
4-
53
/// Maximum Lightning message size (2-byte length prefix limit).
64
pub const MAX_MESSAGE_SIZE: usize = 65535;
75

@@ -79,11 +77,6 @@ impl BigSize {
7977
}
8078
}
8179

82-
hashes::hash_newtype! {
83-
/// A bitcoin transaction hash/transaction ID.
84-
pub struct Txid(sha256d::Hash);
85-
}
86-
8780
#[cfg(test)]
8881
mod tests {
8982
use super::*;

smite/src/bolt/wire.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
use crate::bolt::BoltError;
44
use crate::bolt::types::{
55
BigSize, CHANNEL_ID_SIZE, COMPACT_SIGNATURE_SIZE, ChannelId, PUBLIC_KEY_SIZE, SHA256_HASH_SIZE,
6-
TXID_SIZE, Txid,
6+
TXID_SIZE,
77
};
8+
use bitcoin::Txid;
89
use bitcoin::hashes::{Hash, sha256};
910
use bitcoin::secp256k1::PublicKey;
1011
use bitcoin::secp256k1::ecdsa::Signature;

0 commit comments

Comments
 (0)