@@ -801,18 +801,8 @@ impl ChannelMonitor {
801
801
writer. write_all ( & delayed_payment_base_key[ ..] ) ?;
802
802
writer. write_all ( & payment_base_key[ ..] ) ?;
803
803
writer. write_all ( & shutdown_pubkey. serialize ( ) ) ?;
804
- if let Some ( ref prev_latest_per_commitment_point) = * prev_latest_per_commitment_point {
805
- writer. write_all ( & [ 1 ; 1 ] ) ?;
806
- writer. write_all ( & prev_latest_per_commitment_point. serialize ( ) ) ?;
807
- } else {
808
- writer. write_all ( & [ 0 ; 1 ] ) ?;
809
- }
810
- if let Some ( ref latest_per_commitment_point) = * latest_per_commitment_point {
811
- writer. write_all ( & [ 1 ; 1 ] ) ?;
812
- writer. write_all ( & latest_per_commitment_point. serialize ( ) ) ?;
813
- } else {
814
- writer. write_all ( & [ 0 ; 1 ] ) ?;
815
- }
804
+ prev_latest_per_commitment_point. write ( writer) ?;
805
+ latest_per_commitment_point. write ( writer) ?;
816
806
match funding_info {
817
807
& Some ( ( ref outpoint, ref script) ) => {
818
808
writer. write_all ( & outpoint. txid [ ..] ) ?;
@@ -823,8 +813,8 @@ impl ChannelMonitor {
823
813
debug_assert ! ( false , "Try to serialize a useless Local monitor !" ) ;
824
814
} ,
825
815
}
826
- write_option ! ( current_remote_commitment_txid) ;
827
- write_option ! ( prev_remote_commitment_txid) ;
816
+ current_remote_commitment_txid. write ( writer ) ? ;
817
+ prev_remote_commitment_txid. write ( writer ) ? ;
828
818
} ,
829
819
Storage :: Watchtower { .. } => unimplemented ! ( ) ,
830
820
}
@@ -864,7 +854,7 @@ impl ChannelMonitor {
864
854
writer. write_all( & byte_utils:: be64_to_array( $htlc_output. amount_msat) ) ?;
865
855
writer. write_all( & byte_utils:: be32_to_array( $htlc_output. cltv_expiry) ) ?;
866
856
writer. write_all( & $htlc_output. payment_hash. 0 [ ..] ) ?;
867
- write_option! ( & $htlc_output. transaction_output_index) ;
857
+ $htlc_output. transaction_output_index. write ( writer ) ? ;
868
858
}
869
859
}
870
860
0 commit comments