File tree 1 file changed +8
-10
lines changed
1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -1023,6 +1023,13 @@ impl Invoice {
1023
1023
return Err ( SemanticError :: MultipleDescriptions ) ;
1024
1024
}
1025
1025
1026
+ self . check_payment_secret ( ) ?;
1027
+
1028
+ Ok ( ( ) )
1029
+ }
1030
+
1031
+ /// Checks that there is exactly one payment secret field
1032
+ fn check_payment_secret ( & self ) -> Result < ( ) , SemanticError > {
1026
1033
// "A writer MUST include exactly one `s` field."
1027
1034
let payment_secret_count = self . tagged_fields ( ) . filter ( |& tf| match * tf {
1028
1035
TaggedField :: PaymentSecret ( _) => true ,
@@ -1049,16 +1056,7 @@ impl Invoice {
1049
1056
1050
1057
/// Check that feature bits are set as required
1051
1058
fn check_feature_bits ( & self ) -> Result < ( ) , SemanticError > {
1052
- // "A writer MUST include exactly one `s` field."
1053
- let payment_secret_count = self . tagged_fields ( ) . filter ( |& tf| match * tf {
1054
- TaggedField :: PaymentSecret ( _) => true ,
1055
- _ => false ,
1056
- } ) . count ( ) ;
1057
- if payment_secret_count < 1 {
1058
- return Err ( SemanticError :: NoPaymentSecret ) ;
1059
- } else if payment_secret_count > 1 {
1060
- return Err ( SemanticError :: MultiplePaymentSecrets ) ;
1061
- }
1059
+ self . check_payment_secret ( ) ?;
1062
1060
1063
1061
// "A writer MUST set an s field if and only if the payment_secret feature is set."
1064
1062
// (this requirement has been since removed, and we now require the payment secret
You can’t perform that action at this time.
0 commit comments