A purchase whose post-swap value cannot cover price_per_step x purchase_min_steps is refused after Receive, absorbing the note
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
Direzione di ricerca
Start with the swapFeeSatsBounded pre-check block in src/merchant/merchant.go, and trace where calculateAllotment runs relative to Receive in the PurchaseSession path. Check how price_per_step and purchase_min_steps are read from AcceptedMints. Done means a note that cannot cover the minimum purchase after the swap fee is refused before Receive, and the residual fee-unknown branch has a defined outcome that keeps the value. The issue leaves that residual behaviour open, so settle it with a maintainer first.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
calculateAllotment is called on the post-swap amount, i.e. after Receive has already taken the note into the operator's wallet. When the amount cannot cover price_per_step * purchase_min_steps, the purchase is refused there — with the note spent, no session granted, and no owed-grant record written (that machinery is only reached when grantSessionAccess fails, not when pricing fails). The customer's value is absorbed with no recovery path.
This contradicts this repo's own fund-safety rule (AGENTS.md):
Do not perform irreversible monetary operations (swap, mint, melt, LN settlement) before validations that can be done locally — token decode, spending-condition check, swap-fee pre-check, MAC/NDS pre-flight all run before
Receiveon purpose (#403, #409).
Both sides of the comparison are knowable locally at the existing pre-check: the mint's swap fee was just read (swapFeeSatsBounded), and price_per_step / purchase_min_steps come from AcceptedMints.
Reproduced at b6f7aa74
Config: price_per_step = 210, purchase_min_steps = 1. Note worth 210 sat; the mint charges a 1 sat swap fee.
Before the fix, PurchaseSession returns notice code session-error:
Failed to calculate allotment: payment only covers 0 steps, but minimum purchase is 1 steps
and Receive was called — the note is in the operator's wallet by then.
The existing pre-check (src/merchant/merchant.go, the swapFeeSatsBounded block) only covers tokenAmount <= fee ("nothing left to spend"). A fee smaller than the note that still pushes the post-swap value below the minimum purchase is not covered.
The same happens on a fee-free mint: any note below the minimum purchase is refused after Receive.
Residual case
When the fee cannot be determined locally (cdk adapter, unreachable mint, or the 3s swapFeePrecheckBudget overrun against a wedged mint, #525) the pre-check can only compare the note's face value, which is optimistic. A note that passes can still fall below the minimum once the mint takes its fee. That branch must not silently drop the value either.
- Lingua principale
- Go
- Stelle
- 12
- Fork
- 14
- Merge medio
- 3g 20h
- PR unite (30g)
- 261
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenTollGate/tollgate-module-basic-go
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
OpenTollGate/tollgate-module-basic-go#1159 ·
I maintainer di solito rispondono entro 1 giorno
-
Degraded-mode hygiene follow-ups: dead walletNotInitializedError() + main.go's startup log still over-promises mint recoveryForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenTollGate/tollgate-module-basic-go#1135 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
setup_uhttpd_portal hardcodes the GUEST portal docroot to the TollGate path — the brand token cannot select a re-brand guest portalForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenTollGate/tollgate-module-basic-go#1122 ·
I maintainer di solito rispondono entro 1 giorno
-
changelog: dependency-security sweep missing from [Unreleased] [Amperstrand fork #105 review debt]Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
OpenTollGate/tollgate-module-basic-go#1055 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenTollGate/tollgate-module-basic-go#1027 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenTollGate/tollgate-module-basic-go
Issue simili
-
date_time, url_encode, html_escape, to_unix_time, contains_all and contains_any panic when called without argumentsForse già presa @antcybersec l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
projectdiscovery/dsl#372 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
JuliusBrussee/caveman#1449 ·
I maintainer di solito rispondono entro 1 giorno
-
clawsweeper:fix-shape-clear clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
openclaw/gogcli#1291 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/arrow-swift#209 ·
I maintainer di solito rispondono entro 1 giorno
-
bug(instrumentation/kafka-go): producer hook writes trace headers into the caller's messagesForse già presa @Aryanbhargava18 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
open-telemetry/opentelemetry-go-compile-instrumentation#1669 ·
I maintainer di solito rispondono entro 2 giorni