X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Ftransaction.rs;h=946562bc1781f95f77f62ce4aa252509d77eec10;hb=e7678d42d9563a84e8c60f57237e5e80df98a4d4;hp=0f479ff91abdff8c12aabb277d149f9b1646a5b1;hpb=ce4de5fb52246f91d37127594f8fd7d304ab86ad;p=rust-lightning diff --git a/lightning/src/chain/transaction.rs b/lightning/src/chain/transaction.rs index 0f479ff9..946562bc 100644 --- a/lightning/src/chain/transaction.rs +++ b/lightning/src/chain/transaction.rs @@ -1,6 +1,15 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + //! 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 +19,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]; @@ -31,6 +35,7 @@ impl OutPoint { } /// Converts this OutPoint into the OutPoint field as used by rust-bitcoin + /// (C-not exported) as the same type is used universally in the C bindings for all outpoints pub fn into_bitcoin_outpoint(self) -> BitcoinOutPoint { BitcoinOutPoint { txid: self.txid,