2626
2727use  bitcoin:: secp256k1:: PublicKey ; 
2828use  bitcoin:: secp256k1:: ecdsa:: Signature ; 
29- use  bitcoin:: { secp256k1,  Witness ,   Transaction } ; 
29+ use  bitcoin:: { secp256k1,  Witness } ; 
3030use  bitcoin:: blockdata:: script:: Script ; 
3131use  bitcoin:: hash_types:: { Txid ,  BlockHash } ; 
3232
@@ -42,7 +42,7 @@ use crate::io_extras::read_to_end;
4242
4343use  crate :: events:: { MessageSendEventsProvider ,  OnionMessageProvider } ; 
4444use  crate :: util:: logger; 
45- use  crate :: util:: ser:: { LengthReadable ,  Readable ,  ReadableArgs ,  Writeable ,  Writer ,  WithoutLength ,  FixedLengthReader ,  HighZeroBytesDroppedBigSize ,  Hostname } ; 
45+ use  crate :: util:: ser:: { LengthReadable ,  Readable ,  ReadableArgs ,  Writeable ,  Writer ,  WithoutLength ,  FixedLengthReader ,  HighZeroBytesDroppedBigSize ,  Hostname ,   TransactionU16LenLimited } ; 
4646
4747use  crate :: ln:: { PaymentPreimage ,  PaymentHash ,  PaymentSecret } ; 
4848
@@ -425,45 +425,6 @@ pub struct ChannelReady {
425425 	pub  short_channel_id_alias :  Option < u64 > , 
426426} 
427427
428- /// A wrapper for a `Transaction` which can only be constructed with [`TransactionU16LenLimited::new`] 
429- /// if the `Transaction`'s consensus-serialized length is <= u16::MAX. 
430- /// 
431- /// Use [`TransactionU16LenLimited::into_transaction`] to convert into the contained `Transaction`. 
432- #[ derive( Clone ,  Debug ,  PartialEq ,  Eq ) ]  
433- pub  struct  TransactionU16LenLimited ( Transaction ) ; 
434- 
435- impl  TransactionU16LenLimited  { 
436- 	/// Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus- 
437-  	/// serialized length is <= u16::MAX. 
438-  	pub  fn  new ( transaction :  Transaction )  -> Result < Self ,  ( ) >  { 
439- 		if  transaction. serialized_length ( )  > ( u16:: MAX  as  usize )  { 
440- 			Err ( ( ) ) 
441- 		}  else  { 
442- 			Ok ( Self ( transaction) ) 
443- 		} 
444- 	} 
445- 
446- 	/// Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`. 
447-  	pub  fn  into_transaction ( self )  -> Transaction  { 
448- 		self . 0 
449- 	} 
450- } 
451- 
452- impl  Writeable  for  TransactionU16LenLimited  { 
453- 	fn  write < W :  Writer > ( & self ,  w :  & mut  W )  -> Result < ( ) ,  io:: Error >  { 
454- 		( self . 0 . serialized_length ( )  as  u16 ) . write ( w) ?; 
455- 		self . 0 . write ( w) 
456- 	} 
457- } 
458- 
459- impl  Readable  for  TransactionU16LenLimited  { 
460- 	fn  read < R :  Read > ( r :  & mut  R )  -> Result < Self ,  DecodeError >  { 
461- 		let  len = <u16  as  Readable >:: read ( r) ?; 
462- 		let  mut  tx_reader = FixedLengthReader :: new ( r,  len as  u64 ) ; 
463- 		Ok ( Self ( Readable :: read ( & mut  tx_reader) ?) ) 
464- 	} 
465- } 
466- 
467428/// A tx_add_input message for adding an input during interactive transaction construction 
468429/// 
469430// TODO(dual_funding): Add spec link for `tx_add_input`. 
@@ -850,7 +811,7 @@ impl NetAddress {
850811} 
851812
852813impl  Writeable  for  NetAddress  { 
853- fn  write < W :  Writer > ( & self ,  writer :  & mut  W )  -> Result < ( ) ,  io:: Error >  { 
814+ 	 fn  write < W :  Writer > ( & self ,  writer :  & mut  W )  -> Result < ( ) ,  io:: Error >  { 
854815		match  self  { 
855816			& NetAddress :: IPv4  {  ref  addr,  ref  port }  => { 
856817				1u8 . write ( writer) ?; 
@@ -2454,10 +2415,9 @@ mod tests {
24542415	use  hex; 
24552416	use  crate :: ln:: { PaymentPreimage ,  PaymentHash ,  PaymentSecret } ; 
24562417	use  crate :: ln:: features:: { ChannelFeatures ,  ChannelTypeFeatures ,  InitFeatures ,  NodeFeatures } ; 
2457- 	use  crate :: ln:: msgs:: { self ,  TransactionU16LenLimited } ; 
2458- 	use  crate :: ln:: msgs:: { FinalOnionHopData ,  OnionErrorPacket ,  OnionHopDataFormat } ; 
2418+ 	use  crate :: ln:: msgs:: { self ,  FinalOnionHopData ,  OnionErrorPacket ,  OnionHopDataFormat } ; 
24592419	use  crate :: routing:: gossip:: { NodeAlias ,  NodeId } ; 
2460- 	use  crate :: util:: ser:: { Writeable ,  Readable ,  Hostname } ; 
2420+ 	use  crate :: util:: ser:: { Writeable ,  Readable ,  Hostname ,   TransactionU16LenLimited } ; 
24612421
24622422	use  bitcoin:: hashes:: hex:: FromHex ; 
24632423	use  bitcoin:: util:: address:: Address ; 
0 commit comments