AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 47 Bitcoin

Merge pull request #7780 from tumutech/fix-inventory-counts

Public commit record

What the developer wrote

Authored by Nicolas Dorier

73/100 · Adequate
Merge pull request #7780 from tumutech/fix-inventory-counts

Fix Point of Sale and Crowdfund Perks inventory counts after unpaid invoices
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a bug where BTCPay Server's Point of Sale and Crowdfund inventory counts could become wrong after unpaid or expired invoices. Previously, the system could add inventory back multiple times for the same invoice, making it look like more items were available than actually were. The fix tracks the invoice's previous status so inventory is only adjusted once. The commit also adds a way for tests to wait until background event processing is finished.

Recommended action

Review the inventory-updater logic to confirm no other event pairs can double-adjust inventory, and consider adding an idempotency guard (e.g., processed-event tracking) for production safety beyond status checks. The new WaitForPendingEventsAsync helper should be used in tests that assert on asynchronous event-driven side effects.

Security signals we found

01

Business-logic flaw: inventory counts could be inflated by duplicate restocking events

02

State-machine fix: previous status now tracked to prevent double-counting

03

Race/ordering concern mitigated by deterministic event-barrier for tests

04

No input validation, authentication, cryptography, or injection changes observed

Risk score

Why this scored 47/100

Our methodology →
Potential impact 12/30
Exploitability 5/25
Stealth signal 8/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.