@@ -927,58 +927,17 @@ impl RAAMonitorUpdateBlockingAction {
927
927
}
928
928
}
929
929
930
- impl Writeable for RAAMonitorUpdateBlockingAction {
931
- fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
932
- match self {
933
- RAAMonitorUpdateBlockingAction::ForwardedPaymentInboundClaim { channel_id, htlc_id } => {
934
- 0u8.write(writer)?;
935
- write_tlv_fields!(writer, {
936
- (0, channel_id, required),
937
- (2, htlc_id, required),
938
- });
939
- },
940
- RAAMonitorUpdateBlockingAction::ClaimedMPPPayment { .. } => {
941
- 1u8.write(writer)?;
942
- write_tlv_fields!(writer, {});
943
- // This is rebuilt on restart, so we don't bother writing it.
944
- },
945
- }
946
- Ok(())
947
- }
948
- }
930
+ impl_writeable_tlv_based_enum_upgradable!(RAAMonitorUpdateBlockingAction,
931
+ (0, ForwardedPaymentInboundClaim) => { (0, channel_id, required), (2, htlc_id, required) },
932
+ unread_variants: ClaimedMPPPayment
933
+ );
949
934
950
935
impl Readable for Option<RAAMonitorUpdateBlockingAction> {
951
936
fn read<R: Read>(reader: &mut R) -> Result<Self, DecodeError> {
952
937
Ok(RAAMonitorUpdateBlockingAction::read(reader)?)
953
938
}
954
939
}
955
940
956
- impl MaybeReadable for RAAMonitorUpdateBlockingAction {
957
- fn read<R: Read>(reader: &mut R) -> Result<Option<Self>, DecodeError> {
958
- match <u8 as Readable>::read(reader)? {
959
- 0 => {
960
- _init_and_read_len_prefixed_tlv_fields!(reader, {
961
- (0, channel_id, required),
962
- (2, htlc_id, required),
963
- });
964
- Ok(Some(RAAMonitorUpdateBlockingAction::ForwardedPaymentInboundClaim {
965
- channel_id: channel_id.0.unwrap(),
966
- htlc_id: htlc_id.0.unwrap(),
967
- }))
968
- },
969
- // 1 is ClaimedMPPPayment and is handled in the general odd handling below
970
- x if x % 2 == 1 => {
971
- // Discard the contents
972
- let tlv_len: BigSize = Readable::read(reader)?;
973
- FixedLengthReader::new(reader, tlv_len.0)
974
- .eat_remaining().map_err(|_| DecodeError::ShortRead)?;
975
- Ok(None)
976
- },
977
- _ => Err(DecodeError::InvalidValue),
978
- }
979
- }
980
- }
981
-
982
941
/// State we hold per-peer.
983
942
pub(super) struct PeerState<SP: Deref> where SP::Target: SignerProvider {
984
943
/// `channel_id` -> `ChannelPhase`
0 commit comments