Duplicate Logging in SendBitcoin Method - Premature Success Logging #1
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
SendBitcoin
method logs successful transactions before confirming payment status, leading to duplicate logging where payments are marked as successful even when they may later fail, and then logged again when actually confirmed.Root Cause Analysis
Problem Flow in SendBitcoin Method (Lines ~340-400)
Step 1: Premature Success Logging (Lines ~380-395)
Step 2: Duplicate Success Logging (Lines ~470-490)
The Logical Flow Problem
pendingInvoices
for monitoringImpact
Example Log Output
Steps to Reproduce
/sendblood 100 user@wallet.com
Root Cause: Misunderstanding of SendPayment Success
The issue stems from misinterpreting what "success" means in the SendPayment callback:
Proposed Fix
Solution 1: Remove Premature Logging
Only log when payment is actually confirmed:
Solution 2: Add Status Tracking to Avoid Duplicates
Enhance the logging system to track payment states:
Solution 3: Update Confirmation Logic
Ensure only one success log per payment:
Environment
Severity
🟡 Medium - Data integrity issue affecting logging and analytics
Additional Notes
This bug makes it appear that more payments are successful than actually are, and complicates audit trails. The fix ensures that:
Fixed on 0.4.0