File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -6763,6 +6763,27 @@ func (r *rpcServer) DeleteAllPayments(ctx context.Context,
67636763 req * lnrpc.DeleteAllPaymentsRequest ) (
67646764 * lnrpc.DeleteAllPaymentsResponse , error ) {
67656765
6766+ switch {
6767+ // Since this is a destructive operation, at least one of the options
6768+ // must be set to true.
6769+ case ! req .AllPayments && ! req .FailedPaymentsOnly &&
6770+ ! req .FailedHtlcsOnly :
6771+
6772+ return nil , fmt .Errorf ("at least one of the options " +
6773+ "`all_payments`, `failed_payments_only`, or " +
6774+ "`failed_htlcs_only` must be set to true" )
6775+
6776+ // `all_payments` cannot be true with `failed_payments_only` or
6777+ // `failed_htlcs_only`. `all_payments` includes all records, making
6778+ // these options contradictory.
6779+ case req .AllPayments &&
6780+ (req .FailedPaymentsOnly || req .FailedHtlcsOnly ):
6781+
6782+ return nil , fmt .Errorf ("`all_payments` cannot be set to true " +
6783+ "while either `failed_payments_only` or " +
6784+ "`failed_htlcs_only` is also set to true" )
6785+ }
6786+
67666787 rpcsLog .Infof ("[DeleteAllPayments] failed_payments_only=%v, " +
67676788 "failed_htlcs_only=%v" , req .FailedPaymentsOnly ,
67686789 req .FailedHtlcsOnly )
You can’t perform that action at this time.
0 commit comments