Skip to content

Conversation

@doitian
Copy link
Member

@doitian doitian commented Dec 8, 2025

Summary

This PR adds comprehensive logging for channel auto-accept failures to help operators understand why channels aren't being auto-accepted, making debugging easier when channel opening fails.

Changes

Refactoring

  • Extracted UDT matching logic into a reusable find_matching_udt method in UdtCfgInfos to avoid code duplication
  • Refactored get_udt_info in contracts.rs to use the new method
  • Made get_udt_info public to enable logging functionality

Logging

  • Sender-side logging: Added warnings when opening channels with insufficient funding amounts (CKB or UDT) that don't meet peer's auto-accept requirements
  • Receiver-side logging: Added warnings when auto-accept fails for incoming channel requests, including:
    • Insufficient funding amounts
    • UDT types not configured for auto-accept
    • Auto-accept disabled scenarios
  • All logging is conditional on tracing::Level::WARN being enabled to avoid performance overhead
  • Added ChannelAutoAcceptFailed debug event when auto-accept fails

Testing

  • Added comprehensive unit tests for find_matching_udt covering:
    • Exact match scenarios
    • Regex pattern matching
    • Wrong code_hash, hash_type, and args
    • Multiple UDTs in whitelist
    • Empty whitelist
  • Added integration test test_auto_accept_fails_debug_event to verify debug event is triggered

Benefits

  • Operators can now easily diagnose why channels aren't being auto-accepted
  • Reduces debugging time by providing clear, actionable log messages
  • Helps identify configuration mismatches between peers
  • Maintains performance by only logging when WARN level is enabled

This helps operators understand why channels aren't being
auto-accepted, making debugging easier when channel opening fails.
The logging covers both sender and receiver perspectives, including
warnings when funding amounts are insufficient or UDT types don't
match auto-accept requirements.
@doitian doitian force-pushed the feature/auto-accept-log branch from 34e3fd0 to 1826099 Compare December 27, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[open_channel] No error message when funding_amount is less than open_channel_auto_accept_min_ckb_funding_amount

1 participant