X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Ftransaction.rs;h=d490797bc8e74cc541d1c4db4269d876991c9324;hb=b1d536e57ac99c7446f50c4f64c4a8b46c3b3830;hp=ce43984ebd48b270f0f32da2266da2ac940e2a6b;hpb=06091cee0fd29549e5e24c673bf361ab3a562529;p=rust-lightning diff --git a/lightning/src/chain/transaction.rs b/lightning/src/chain/transaction.rs index ce43984e..d490797b 100644 --- a/lightning/src/chain/transaction.rs +++ b/lightning/src/chain/transaction.rs @@ -1,6 +1,6 @@ //! Contains simple structs describing parts of transactions on the chain. -use bitcoin_hashes::sha256d::Hash as Sha256dHash; +use bitcoin::hash_types::Txid; use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint; /// A reference to a transaction output. @@ -10,17 +10,12 @@ use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] pub struct OutPoint { /// The referenced transaction's txid. - pub txid: Sha256dHash, + pub txid: Txid, /// The index of the referenced output in its transaction's vout. pub index: u16, } impl OutPoint { - /// Creates a new `OutPoint` from the txid and the index. - pub fn new(txid: Sha256dHash, index: u16) -> OutPoint { - OutPoint { txid, index } - } - /// Convert an `OutPoint` to a lightning channel id. pub fn to_channel_id(&self) -> [u8; 32] { let mut res = [0; 32]; @@ -39,6 +34,8 @@ impl OutPoint { } } +impl_writeable!(OutPoint, 0, { txid, index }); + #[cfg(test)] mod tests { use chain::transaction::OutPoint;