X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fchain%2Ftransaction.rs;h=e8ebae7092556286e4a6f22a8bfde7baa0ef9b30;hb=d33cb3cca560ec33b33542c1ef6e47f15b35e30a;hp=f89b6080600a46b32bcbc5afc4ff66cafdd39c42;hpb=11e5975523147ae7024b03f05445c78c9b695752;p=rust-lightning diff --git a/src/chain/transaction.rs b/src/chain/transaction.rs index f89b6080..e8ebae70 100644 --- a/src/chain/transaction.rs +++ b/src/chain/transaction.rs @@ -1,7 +1,10 @@ +//! Contains simple structs describing parts of transactions on the chain. + use bitcoin::util::hash::Sha256dHash; use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint; /// A reference to a transaction output. +/// /// Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32 /// due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] @@ -13,7 +16,7 @@ pub struct OutPoint { } impl OutPoint { - /// Creates a new `OutPoint` from the txid an the index. + /// Creates a new `OutPoint` from the txid and the index. pub fn new(txid: Sha256dHash, index: u16) -> OutPoint { OutPoint { txid, index } } @@ -27,6 +30,7 @@ impl OutPoint { res } + /// Converts this OutPoint into the OutPoint field as used by rust-bitcoin pub fn into_bitcoin_outpoint(self) -> BitcoinOutPoint { BitcoinOutPoint { txid: self.txid,