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;
43
43
use crate :: ln:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
44
44
45
45
use crate :: util:: byte_utils:: { be48_to_array, slice_to_be48} ;
46
+ use crate :: util:: string:: UntrustedString ;
46
47
47
48
/// serialization buffer size
48
49
pub const MAX_BUF_SIZE : usize = 64 * 1024 ;
@@ -629,6 +630,21 @@ impl<'a> From<&'a String> for WithoutLength<&'a String> {
629
630
fn from ( s : & ' a String ) -> Self { Self ( s) }
630
631
}
631
632
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
+
632
648
impl < ' a , T : Writeable > Writeable for WithoutLength < & ' a Vec < T > > {
633
649
#[ inline]
634
650
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
You can’t perform that action at this time.
0 commit comments