Merge rust-bitcoin/rust-bitcoin#3576: transaction: Add plural field getters
be553217f1
transaction: Add plural field getters (Tobin C. Harding) Pull request description: The `Transaction` type was created way back when, and the field names were named using singular (`input` and `output`). In hindsite plural probably should have been used since its more idiomatic Rust but the fields have been around so long now that re-naming them is going annoy a whole bunch of people. As a compromise add getters that use plural, immutable and mutable versions, for both the `input` and `output` fields. Close: #822 ACKs for top commit: apoelstra: ACK be553217f19069dd9ca28c3ba5953059df9caa1b; successfully ran local tests; though will let this sit a couple days before merging sanket1729: ACKbe553217f1
Tree-SHA512: 4df9db179a69c9eea2940008c9eca9f9b9b9d9f27e2a174db39bfb3d5c32a9d06b26e5349e5baf5af78600ae128d1b534559baf7335aec6df1238de96a508764
This commit is contained in:
commit
3d17ec962f
|
@ -113,6 +113,18 @@ impl Transaction {
|
|||
/// Maximum transaction weight for Bitcoin Core 25.0.
|
||||
pub const MAX_STANDARD_WEIGHT: Weight = Weight::from_wu(400_000);
|
||||
|
||||
/// Returns a reference to the transaction inputs.
|
||||
pub fn inputs(&self) -> &[TxIn] { &self.input }
|
||||
|
||||
/// Returns a mutable reference to the transaction inputs.
|
||||
pub fn inputs_mut(&mut self) -> &mut [TxIn] { &mut self.input }
|
||||
|
||||
/// Returns a reference to the transaction outputs.
|
||||
pub fn outputs(&self) -> &[TxOut] { &self.output }
|
||||
|
||||
/// Returns a mutable reference to the transaction outputs.
|
||||
pub fn outputs_mut(&mut self) -> &mut [TxOut] { &mut self.output }
|
||||
|
||||
/// Computes a "normalized TXID" which does not include any signatures.
|
||||
///
|
||||
/// This gives a way to identify a transaction that is "the same" as
|
||||
|
|
Loading…
Reference in New Issue