Referral: user-chosen payout threshold above the system minimum#212
Merged
Conversation
Referrers can set a personal payout_threshold (satoshis) so they batch commission up to a larger amount and avoid many tiny payouts (on-chain in particular). The value must be >= the system minimum for the payout mode (API rejects lower); the effective threshold at payout time is max(system_min, payout_threshold), so a referrer can only raise the bar. - Add referral.payout_threshold column (migration) + model field. - Payout worker uses effective_min_msat() in both the Lightning and on-chain paths. - POST/PATCH /api/v1/referral accept + validate payout_threshold; it's returned on the Referral response and admin referral endpoints (admin override is not bounded by the system minimum). - Unit tests for effective_min_msat and validate_payout_threshold. - Docs + changelog; also corrected stale lightning_address/onchain_address docs to the merged single 'address' field.
v0l
enabled auto-merge
July 24, 2026 10:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the on-chain referral payout work (#184). Referrers — on-chain ones especially — often don't want a stream of tiny payouts. This lets a referrer set a personal
payout_threshold(in satoshis) so commission batches up to a larger amount before an automated payout is made.Behaviour
payout_thresholdonPOST/PATCH /api/v1/referral, returned on theReferralresponse and admin referral endpoints.min-payout-sats, on-chain usesmin-onchain-payout-sats); the API rejects lower values.max(system minimum, payout_threshold)— a referrer can raise the bar but never lower it below the operator's floor.null/omitted keeps the current behaviour (system minimum).Changes
referral.payout_threshold; model + DB (mysql + mock) updated.effective_min_msat()in both the Lightning and on-chain (payable_onchain_msat) paths.validate_payout_threshold/system_min_payout_sats) + request/response wiring.effective_min_msatandvalidate_payout_threshold.lightning_address/onchain_addressdocs to the merged singleaddressfield from feat(referral): on-chain payout mode, batched into a single send-many tx #208.