1 use bitcoin::util::hash::Sha256dHash;
2 use bitcoin::util::uint::Uint256;
4 /// A reference to a transaction output.
5 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
7 /// The referenced transaction's txid.
9 /// The index of the referenced output in its transaction's vout.
14 /// Creates a new `OutPoint` from the txid an the index.
15 pub fn new(txid: Sha256dHash, index: u16) -> OutPoint {
16 OutPoint { txid, index }
19 /// Convert an `OutPoint` to a lightning channel id.
20 pub fn to_channel_id(&self) -> Uint256 {
22 self.txid.into_be() ^ Uint256::from_u64(self.index as u64).unwrap()