@@ -22,7 +22,7 @@ use bitcoin::hash_types::{Txid, PubkeyHash};
22
22
23
23
use ln:: { PaymentHash , PaymentPreimage } ;
24
24
use ln:: msgs:: DecodeError ;
25
- use util:: ser:: { Readable , Writeable , Writer , MAX_BUF_SIZE } ;
25
+ use util:: ser:: { Readable , Writeable , Writer } ;
26
26
use util:: byte_utils;
27
27
28
28
use bitcoin:: hash_types:: WPubkeyHash ;
@@ -36,18 +36,11 @@ use core::cmp;
36
36
use ln:: chan_utils;
37
37
use util:: transaction_utils:: sort_outputs;
38
38
use ln:: channel:: INITIAL_COMMITMENT_NUMBER ;
39
- use std:: io:: Read ;
40
39
use core:: ops:: Deref ;
41
40
use chain;
42
41
43
- // Maximum size of a serialized HTLCOutputInCommitment
44
- pub ( crate ) const HTLC_OUTPUT_IN_COMMITMENT_SIZE : usize = 1 + 8 + 4 + 32 + 5 ;
45
-
46
42
pub ( crate ) const MAX_HTLCS : u16 = 483 ;
47
43
48
- // This checks that the buffer size is greater than the maximum possible size for serialized HTLCS
49
- const _EXCESS_BUFFER_SIZE: usize = MAX_BUF_SIZE - MAX_HTLCS as usize * HTLC_OUTPUT_IN_COMMITMENT_SIZE ;
50
-
51
44
pub ( super ) const HTLC_SUCCESS_TX_WEIGHT : u64 = 703 ;
52
45
pub ( super ) const HTLC_TIMEOUT_TX_WEIGHT : u64 = 663 ;
53
46
@@ -866,44 +859,16 @@ impl PartialEq for CommitmentTransaction {
866
859
}
867
860
}
868
861
869
- /// (C-not exported) as users never need to call this directly
870
- impl Writeable for Vec < HTLCOutputInCommitment > {
871
- #[ inline]
872
- fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , :: std:: io:: Error > {
873
- ( self . len ( ) as u16 ) . write ( w) ?;
874
- for e in self . iter ( ) {
875
- e. write ( w) ?;
876
- }
877
- Ok ( ( ) )
878
- }
879
- }
880
-
881
- /// (C-not exported) as users never need to call this directly
882
- impl Readable for Vec < HTLCOutputInCommitment > {
883
- #[ inline]
884
- fn read < R : Read > ( r : & mut R ) -> Result < Self , DecodeError > {
885
- let len: u16 = Readable :: read ( r) ?;
886
- let byte_size = ( len as usize )
887
- . checked_mul ( HTLC_OUTPUT_IN_COMMITMENT_SIZE )
888
- . ok_or ( DecodeError :: BadLengthDescriptor ) ?;
889
- if byte_size > MAX_BUF_SIZE {
890
- return Err ( DecodeError :: BadLengthDescriptor ) ;
891
- }
892
- let mut ret = Vec :: with_capacity ( len as usize ) ;
893
- for _ in 0 ..len { ret. push ( HTLCOutputInCommitment :: read ( r) ?) ; }
894
- Ok ( ret)
895
- }
896
- }
897
-
898
862
impl_writeable_tlv_based ! ( CommitmentTransaction , {
899
863
( 0 , commitment_number) ,
900
864
( 2 , to_broadcaster_value_sat) ,
901
865
( 4 , to_countersignatory_value_sat) ,
902
866
( 6 , feerate_per_kw) ,
903
- ( 8 , htlcs) ,
904
- ( 10 , keys) ,
905
- ( 12 , built) ,
906
- } , { } , { } ) ;
867
+ ( 8 , keys) ,
868
+ ( 10 , built) ,
869
+ } , { } , {
870
+ ( 12 , htlcs) ,
871
+ } ) ;
907
872
908
873
impl CommitmentTransaction {
909
874
/// Construct an object of the class while assigning transaction output indices to HTLCs.
0 commit comments