@@ -11,12 +11,19 @@ pub use bitcoin::{
1111
1212use serde:: Deserialize ;
1313
14+ /// It contains the value and scriptpubkey of a
15+ /// previous transaction output that a transaction
16+ /// input can reference.
1417#[ derive( Deserialize , Clone , Debug , PartialEq , Eq ) ]
1518pub struct PrevOut {
1619 pub value : u64 ,
1720 pub scriptpubkey : ScriptBuf ,
1821}
1922
23+ /// Represents the transaction input containing
24+ /// a Previous output (or none if coinbase) and includes
25+ /// the unlocking script, witness data, sequence number,
26+ /// and a flag indicating if it is a coinbase input.
2027#[ derive( Deserialize , Clone , Debug , PartialEq , Eq ) ]
2128pub struct Vin {
2229 pub txid : Txid ,
@@ -30,13 +37,15 @@ pub struct Vin {
3037 pub is_coinbase : bool ,
3138}
3239
40+ /// Represents the transaction output containing a value and
41+ /// a scriptpubkey.
3342#[ derive( Deserialize , Clone , Debug , PartialEq , Eq ) ]
3443pub struct Vout {
3544 pub value : u64 ,
3645 pub scriptpubkey : ScriptBuf ,
3746}
3847
39- ///Represents Transaction Status.
48+ /// Represents Transaction Status.
4049#[ derive( Deserialize , Clone , Debug , PartialEq , Eq ) ]
4150pub struct TxStatus {
4251 pub confirmed : bool ,
@@ -45,6 +54,10 @@ pub struct TxStatus {
4554 pub block_time : Option < u64 > ,
4655}
4756
57+ /// It holds the block height, a Merkle path of
58+ /// transaction IDs, and the position of the
59+ /// transaction in the tree to verify its inclusion
60+ /// in a block.
4861#[ derive( Deserialize , Clone , Debug , PartialEq , Eq ) ]
4962pub struct MerkleProof {
5063 pub block_height : u32 ,
@@ -61,7 +74,7 @@ pub struct OutputStatus {
6174 pub status : Option < TxStatus > ,
6275}
6376
64- ///A Struct represents the status of a block in the blockchain.
77+ /// This Struct represents the status of a block in the blockchain.
6578/// `in_best_chain` - a boolean that shows whether the block is part of the main chain.
6679/// `height` - Optional field that shows the height of the block if block is in main chain.
6780/// `next_best` - Optional field that contains `BlockHash` of the next block that may represent
@@ -73,7 +86,7 @@ pub struct BlockStatus {
7386 pub next_best : Option < BlockHash > ,
7487}
7588
76- ///Structure represents a complete transaction
89+ /// Structure represents a complete transaction
7790#[ derive( Deserialize , Clone , Debug , PartialEq , Eq ) ]
7891pub struct Tx {
7992 pub txid : Txid ,
@@ -89,14 +102,14 @@ pub struct Tx {
89102 pub fee : u64 ,
90103}
91104
92- ///Returns timing information of a Block
105+ /// Returns timing information of a Block
93106/// containg `timestamp` and `height` of block
94107#[ derive( Deserialize , Clone , Debug , PartialEq , Eq ) ]
95108pub struct BlockTime {
96109 pub timestamp : u64 ,
97110 pub height : u32 ,
98111}
99- ///Provides a Summary of a Bitcoin block which includes
112+ /// Provides a Summary of a Bitcoin block which includes
100113/// `BlockHash`, `BlockTime`, `previousblockhash`, `merkle_root`.
101114#[ derive( Debug , Clone , Deserialize , PartialEq , Eq ) ]
102115pub struct BlockSummary {
@@ -135,7 +148,7 @@ pub struct AddressTxsSummary {
135148}
136149
137150impl Tx {
138- ///Converts a transaction into a standard `Bitcoin transaction`.
151+ /// Converts a transaction into a standard `Bitcoin transaction`.
139152 pub fn to_tx ( & self ) -> Transaction {
140153 Transaction {
141154 version : transaction:: Version :: non_standard ( self . version ) ,
@@ -166,7 +179,7 @@ impl Tx {
166179 }
167180 }
168181
169- ///Checks Transaction status, returns a `BlockTime` struct contaning
182+ /// Checks Transaction status, returns a `BlockTime` struct contaning
170183 /// `height` and `timestamp` if transaction has been confirmed or
171184 /// `None` otherwise.
172185 pub fn confirmation_time ( & self ) -> Option < BlockTime > {
@@ -181,7 +194,7 @@ impl Tx {
181194 }
182195 }
183196
184- ///Takes Transaction as input
197+ /// Takes Transaction as input
185198 /// iterates through all the inputs present in the transaction
186199 /// and checks for prevout field and creates a `TxOut` Struct for each input if it exists
187200 /// then returns all optional TxOut values as a vector.
@@ -197,12 +210,12 @@ impl Tx {
197210 } )
198211 . collect ( )
199212 }
200- ///Takes Transaction as input and returns
213+ /// Takes Transaction as input and returns
201214 /// the `Weight instance` of the weight present in Transaction.
202215 pub fn weight ( & self ) -> Weight {
203216 Weight :: from_wu ( self . weight )
204217 }
205- ///Takes Transaction as input and returns
218+ /// Takes Transaction as input and returns
206219 /// the `Amount instance` of the satoshis present in Transaction.
207220 pub fn fee ( & self ) -> Amount {
208221 Amount :: from_sat ( self . fee )
0 commit comments