Simplify pending finalization failure logs
What changed, and why it matters
This commit is a minor code cleanup that simplifies how BTCPay Server writes log messages when a pending multi-signature transaction fails to finalize. It removes the list of failed input indexes from the log and merges two nearly identical log statements into one. There is no security-relevant change.
No action needed. This is a routine logging refactor with no security implications.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change refactors logging in PendingTransactionService.cs. It removes the failedInputIndexes variable and the conditional LogWarning/LogDebug branches, replacing them with a single logger.Log call whose level is chosen by a ternary expression. The log message still records pending transaction ID, signature progress, and formatted finalization errors. No logic, error handling, authorization, cryptography, or data flow is altered.
Changed components
BTCPayServer/HostedServices/PendingTransactionService.csInspect captured patch +11 / −27
diff --git a/BTCPayServer/HostedServices/PendingTransactionService.cs b/BTCPayServer/HostedServices/PendingTransactionService.cs
index ad502d2..486286e 100644
--- a/BTCPayServer/HostedServices/PendingTransactionService.cs
+++ b/BTCPayServer/HostedServices/PendingTransactionService.cs
@@ -236,34 +236,18 @@ public class PendingTransactionService(
}
else
{
- var failedInputIndexes = finalizationErrors is null or { Count: 0 }
- ? "unknown"
- : string.Join(",", finalizationErrors.Select(error => error.InputIndex).Distinct());
var finalizationErrorDetails = FormatFinalizationErrors(finalizationErrors);
- if ((blob.SignaturesCollected ?? 0) >= (blob.SignaturesNeeded ?? int.MaxValue))
- {
- logger.LogWarning(
- "Finalization attempt failed for pending transaction {PendingTransactionId} despite signature progress " +
- "{SignaturesCollected}/{SignaturesNeeded}. Failed input indexes: {FailedInputIndexes}. " +
- "Errors: {FinalizationErrors}",
- pendingTransaction.Id,
- blob.SignaturesCollected,
- blob.SignaturesNeeded,
- failedInputIndexes,
- finalizationErrorDetails);
- }
- else
- {
- logger.LogDebug(
- "Finalization attempt failed for pending transaction {PendingTransactionId}. Signature progress: " +
- "{SignaturesCollected}/{SignaturesNeeded}; failed input indexes: {FailedInputIndexes}. " +
- "Errors: {FinalizationErrors}",
- pendingTransaction.Id,
- blob.SignaturesCollected,
- blob.SignaturesNeeded,
- failedInputIndexes,
- finalizationErrorDetails);
- }
+ var logLevel = (blob.SignaturesCollected ?? 0) >= (blob.SignaturesNeeded ?? int.MaxValue)
+ ? LogLevel.Warning
+ : LogLevel.Debug;
+ logger.Log(
+ logLevel,
+ "Finalization attempt failed for pending transaction {PendingTransactionId}. Signature progress: " +
+ "{SignaturesCollected}/{SignaturesNeeded}. Errors: {FinalizationErrors}",
+ pendingTransaction.Id,
+ blob.SignaturesCollected,
+ blob.SignaturesNeeded,
+ finalizationErrorDetails);
}
pendingTransaction.SetBlob(blob);
return (pendingTransaction, retained);
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.