File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ use crate::ln::msgs::PartialSignatureWithNonce;
4343use crate :: ln:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
4444
4545use crate :: util:: byte_utils:: { be48_to_array, slice_to_be48} ;
46+ use crate :: util:: string:: UntrustedString ;
4647
4748/// serialization buffer size
4849pub const MAX_BUF_SIZE : usize = 64 * 1024 ;
@@ -629,6 +630,21 @@ impl<'a> From<&'a String> for WithoutLength<&'a String> {
629630 fn from ( s : & ' a String ) -> Self { Self ( s) }
630631}
631632
633+
634+ impl Writeable for WithoutLength < & UntrustedString > {
635+ #[ inline]
636+ fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
637+ WithoutLength ( & self . 0 . 0 ) . write ( w)
638+ }
639+ }
640+ impl Readable for WithoutLength < UntrustedString > {
641+ #[ inline]
642+ fn read < R : Read > ( r : & mut R ) -> Result < Self , DecodeError > {
643+ let s: WithoutLength < String > = Readable :: read ( r) ?;
644+ Ok ( Self ( UntrustedString ( s. 0 ) ) )
645+ }
646+ }
647+
632648impl < ' a , T : Writeable > Writeable for WithoutLength < & ' a Vec < T > > {
633649 #[ inline]
634650 fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
You can’t perform that action at this time.
0 commit comments