File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,10 @@ pub trait BlockCheckedExt: sealed::Sealed {
273273 ///
274274 /// > Total size is the block size in bytes with transactions serialized as described in BIP-0144,
275275 /// > including base data and witness data.
276+ ///
277+ /// # Panics
278+ ///
279+ /// If the size calculation overflows.
276280 fn total_size ( & self ) -> usize ;
277281
278282 /// Returns the coinbase transaction.
@@ -304,6 +308,9 @@ impl BlockCheckedExt for Block<Checked> {
304308 Weight :: from_wu ( wu. to_u64 ( ) )
305309 }
306310
311+ /// # Panics
312+ ///
313+ /// If the size calculation overflows.
307314 fn total_size ( & self ) -> usize {
308315 let mut size = Header :: SIZE ;
309316
Original file line number Diff line number Diff line change @@ -286,12 +286,20 @@ pub trait TransactionExt: sealed::Sealed {
286286 /// Returns the base transaction size.
287287 ///
288288 /// > Base transaction size is the size of the transaction serialised with the witness data stripped.
289+ ///
290+ /// # Panics
291+ ///
292+ /// If the size calculation overflows.
289293 fn base_size ( & self ) -> usize ;
290294
291295 /// Returns the total transaction size.
292296 ///
293297 /// > Total transaction size is the transaction size in bytes serialized as described in BIP-0144,
294298 /// > including base data and witness data.
299+ ///
300+ /// # Panics
301+ ///
302+ /// If the size calculation overflows.
295303 fn total_size ( & self ) -> usize ;
296304
297305 /// Returns the "virtual size" (vsize) of this transaction.
@@ -385,6 +393,9 @@ impl TransactionExt for Transaction {
385393 Weight :: from_wu ( wu. to_u64 ( ) )
386394 }
387395
396+ /// # Panics
397+ ///
398+ /// If the size calculation overflows.
388399 fn base_size ( & self ) -> usize {
389400 let mut size: usize = 4 ; // Serialized length of a u32 for the version number.
390401
@@ -397,6 +408,9 @@ impl TransactionExt for Transaction {
397408 size + absolute:: LockTime :: SIZE
398409 }
399410
411+ /// # Panics
412+ ///
413+ /// If the size calculation overflows.
400414 #[ inline]
401415 fn total_size ( & self ) -> usize {
402416 let mut size: usize = 4 ; // Serialized length of a u32 for the version number.
Original file line number Diff line number Diff line change @@ -131,6 +131,10 @@ impl Witness {
131131 pub fn len ( & self ) -> usize { self . witness_elements }
132132
133133 /// Returns the number of bytes this witness contributes to a transactions total size.
134+ ///
135+ /// # Panics
136+ ///
137+ /// If the size calculation overflows.
134138 pub fn size ( & self ) -> usize {
135139 let mut size: usize = 0 ;
136140
You can’t perform that action at this time.
0 commit comments