Skip to content

cleanup: remove redundant network port identifiers from maker logs an…#799

Open
Abhishek2634 wants to merge 6 commits intocitadel-tech:masterfrom
Abhishek2634:cleanup/remove-network-port
Open

cleanup: remove redundant network port identifiers from maker logs an…#799
Abhishek2634 wants to merge 6 commits intocitadel-tech:masterfrom
Abhishek2634:cleanup/remove-network-port

Conversation

@Abhishek2634
Copy link

@Abhishek2634 Abhishek2634 commented Mar 14, 2026

Pull Request

Description

Fixed redundant logging identifiers where the network port was used as a prefix. Removed the port field from ThreadPool as it was only used for logging.

Closes #798

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactor / performance improvement
  • Documentation update only
  • CI / Docker / Build changes
  • Other (please describe):

Fix Screenshot

Integration tests passed
Screenshot 2026-03-14 at 3 42 35 PM

Protocol Version(s) Affected

  • Legacy (ECDSA — messages.rs, contract.rs, handlers.rs)
  • Taproot-Musig2 (messages2.rs, contract2.rs, handlers2.rs)
  • Both
  • Neither (infrastructure / tooling only)

Note: When modifying protocol logic, changes must be made to both versions unless the
scope is explicitly version-specific.

Affected Component(s)

  • makerd (background daemon)
  • taker (CLI client)
  • maker-cli (command-line tool)
  • Core protocol / cryptography / library
  • watch_tower (contract monitoring & recovery)
  • Docker / deployment scripts
  • Tests / test framework
  • Documentation (docs/)
  • Other (please specify):

Checklist

Code Quality

  • I ran cargo +nightly fmt --all and committed the result
  • I ran cargo +stable clippy --all-features --lib --bins --tests -- -D warnings with zero warnings
  • I ran cargo +stable clippy --examples -- -D warnings with zero warnings
  • I ran RUSTDOCFLAGS="-D warnings" cargo +nightly doc --all-features --document-private-items --no-deps with zero warnings
  • Pre-commit git hook passes (ln -s ../../git_hooks/pre-commit .git/hooks/pre-commit if not already set)

Testing

  • All unit tests pass (cargo test)
  • Integration tests pass (cargo test --features integration-test)
  • Changes were manually tested on regtest
  • End-to-end maker ↔ taker swap tested (where applicable)
  • Test-only code is gated behind #[cfg(feature = "integration-test")]

Documentation

  • Relevant files in the docs/ folder were updated
  • Complex logic is commented

Security & Privacy (Critical)

  • This change preserves trustlessness and atomic swap guarantees
  • No regression in sybil resistance or fidelity bond logic
  • Tor anonymity and P2P message flow were reviewed
  • No new attack vectors or trust assumptions introduced
  • Edge cases and error handling considered
  • ZMQ subscription integrity (raw tx/block feed) is unaffected
  • integration-test feature flag is not reachable in production code paths

How to Test

# Standard swap (good baseline)
cargo test --test standard_swap --features integration-test -- --nocapture

# Abort scenarios
cargo test --test abort1 --features integration-test -- --nocapture
cargo test --test taproot_taker_abort1 --features integration-test -- --nocapture

# Malicious behavior & recovery
cargo test --test malice1 --features integration-test -- --nocapture
cargo test --test taproot_timelock_recovery --features integration-test -- --nocapture

# Or run the full suite
cargo test --features integration-test

Summary by CodeRabbit

  • Refactor

    • Standardized and simplified logs across the maker module: removed per-port prefixes and now show peer, swap, or contract contexts with clearer thread/join messages.
  • New Features

    • Added private-key handover handling in the maker message flow.
    • Added a sweep action to sweep incoming swapcoins after successful coinswaps.
  • Chores

    • Startup now logs the Bitcoin network; connection logs include remote peer addresses; minor formatting and verbosity cleanups.

@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b0b194cf-2ccc-488f-bad1-38a65564458b

📥 Commits

Reviewing files that changed from the base of the PR and between 449c555 and 20d457a.

📒 Files selected for processing (3)
  • src/maker/api2.rs
  • src/maker/handlers2.rs
  • src/maker/server.rs

📝 Walkthrough

Walkthrough

The PR removes the maker's network port identifier: ThreadPool.port and its constructor argument were deleted; logging and contexts previously using the network port were replaced with thread names, peer SocketAddrs, swap ids, or contract identifiers. handle_client gained a peer address parameter.

Changes

Cohort / File(s) Summary
ThreadPool refactor
src/maker/api.rs, src/maker/api2.rs
Removed pub(crate) port: u16 from ThreadPool; changed ThreadPool::new(port: u16)ThreadPool::new(); join logging no longer references port.
Maker init & thread usage
src/maker/api.rs, src/maker/api2.rs, src/maker/server.rs, src/maker/server2.rs
Dropped network_port propagation during Maker initialization and thread spawning; replaced port-prefixed logs with generic/thread-name or peer-aware messages; added sweep_after_successful_coinswap in api2.rs.
Recovery & contract logging
src/maker/api.rs, src/maker/api2.rs
Replaced port-based log headers with identifiers like [Peer: {ip}] and [Contract: {anchor_id}]; extracted anchor_id/anchor_txid from swapcoins for logs; standardized wording.
Handlers & message flows
src/maker/handlers.rs, src/maker/handlers2.rs
Removed network_port from many logs; shifted logs to swap-id or contract-scoped prefixes; added/wired handle_privkey_handover in handlers2.rs; formatting tweaks only.
Server client handling
src/maker/server.rs
handle_client signature changed to accept peer SocketAddr; call sites updated; connection and error logs now include [Peer: <addr>].
RPC / Server startup logs
src/maker/rpc/server.rs, src/maker/server2.rs
Simplified bind/start logs and removed port interpolations from many runtime/status messages; no control-flow changes.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • mojoX911
  • hulxv

Poem

🐰 I hopped through logs and chased each port away,
Threads now wear names and peers can proudly stay.
Contracts and swaps gleam clear beneath the moon,
I nudged the clutter — lighter is the tune.
The maker hums, a tidy, tuneful day.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: removing redundant network port identifiers from maker logs, which matches the PR's core objective of eliminating port-based logging.
Description check ✅ Passed The description covers all required sections: clear purpose (removing port identifiers), related issue (#798), type of change (bug fix), affected components, comprehensive checklist completion, and testing instructions.
Linked Issues check ✅ Passed The PR fully addresses issue #798 by removing the network port field from ThreadPool, eliminating port-based log prefixes across all affected maker files (api.rs, api2.rs, handlers.rs, handlers2.rs, rpc/server.rs, server.rs, server2.rs) and replacing them with better identifiers.
Out of Scope Changes check ✅ Passed All changes are directly in scope of issue #798: removing network port identifiers from logs and the ThreadPool struct. The addition of sweep_after_successful_coinswap method in api2.rs appears to be a minor related addition without introducing unrelated functionality.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Abhishek2634
Copy link
Author

Abhishek2634 commented Mar 14, 2026

Hi @mojoX911

I have completed the refactoring for the issue regarding redundant network port identifiers. Here was my approach to solving it:

Remove the redundant port field from ThreadPool in api.rs and api2.rs.
Strip out [{}] and network_port arguments from all log macros across the Maker crates.
remove all "argument never used" errors and verified everything with the standard_swap integration test.

I have done runnig cargo check and cargo test --features=integration-test --test standard_swap -- --nocapture . and all test passed here. I have attached the screenshot of test results above in this PR.

Thanks :)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/maker/server.rs (1)

333-379: 🛠️ Refactor suggestion | 🟠 Major

Keep peer identity in the legacy server logs.

These messages now log connection lifecycle and message traffic with no peer or swap context. With concurrent legacy sessions, Connection ended., <=== ..., and Error Handling client request ... become hard to attribute. Capture stream.peer_addr() once and include it in these logs.

Also applies to: 517-523

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/maker/server.rs` around lines 333 - 379, In handle_client, capture the
client's peer address once at the start (call stream.peer_addr() and store it)
and include that peer identifier in all subsequent logs within this function
(e.g., the "Connection ended.", "<=== {}", "===> {}", and any error logs
including the MakerError branches and IO send errors); update log lines around
read_message, serde_cbor::from_slice, send_message, and the MakerError match so
they prepend or interpolate the stored peer address to provide per-connection
context while leaving existing control flow and error handling unchanged.
src/maker/handlers.rs (1)

56-63: 🛠️ Refactor suggestion | 🟠 Major

Keep the swap id in the legacy handler logs.

Most of these legacy-path logs dropped the port prefix without replacing it with id / message.id, even though that identifier is already available in the same scope. On a maker handling multiple legacy swaps, messages like Reserved ... UTXOs, Prepared outgoing funding txs, and Broadcasted funding txs are now ambiguous. Please follow the taproot pattern and carry the swap id through these log lines.

Example pattern
-            log::debug!("Reserved {} UTXOs for swap", connection_state.reserve_utxo.len(),);
+            log::debug!(
+                "[Swap: {}] Reserved {} UTXOs for swap",
+                message.id,
+                connection_state.reserve_utxo.len(),
+            );

Based on learnings Maker handler changes must be duplicated across legacy (\handlers.rs`) and Taproot (`handlers2.rs`) implementations`.

Also applies to: 251-295, 327-484, 610-618, 650-699

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/maker/handlers.rs` around lines 56 - 63, The legacy handler logs drop the
swap identifier making messages ambiguous; update all log calls in
src/maker/handlers.rs that handle legacy swap messages (including the block for
TakerToMakerMessage::WaitingFundingConfirmation and the other ranges mentioned)
to include the swap id/message.id like the Taproot handler does—e.g., change
log::info!("Reserved ... UTXOs") / "Prepared outgoing funding txs" /
"Broadcasted funding txs" to include the id variable (or message.id) in the log
string, and propagate that id through the same code paths (where functions or
closures reference id, use the existing id.clone() or message.id) so every
legacy log line prints the swap id for unambiguous tracing.
src/maker/api.rs (1)

919-934: ⚠️ Potential issue | 🟠 Major

Do not log the full watch-response transaction at info!.

This path immediately inspects witness data for preimages, so dumping transaction here can persist the revealed secret and produces very noisy logs. Log the txid or an outpoint summary instead.

Safer logging
-        log::info!("Received WatchResponse with mempool txs: {:?}", transaction);
+        log::info!(
+            "Received WatchResponse for mempool tx {}",
+            transaction.compute_txid()
+        );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/maker/api.rs` around lines 919 - 934, The current info log prints the
entire WatchResponse transaction (variable transaction) which can leak witness
preimages; change the logging in the loop over responses to avoid serializing
witness data — instead log safe identifiers such as transaction.txid (or a short
outpoint summary built from each input's previous_output.txid and vout) and/or
the input count; keep the rest of the logic that checks input.witness and calls
update_swapcoins_with_preimages(maker, incomings, &preimages, true) /
update_swapcoins_with_preimages(maker, outgoings, &preimages, false) unchanged,
and ensure no witness bytes are included in the new log.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/maker/api.rs`:
- Around line 608-617: The recovery logs currently emit generic messages and
must include stable identifiers so concurrent recoveries are traceable: update
the log! and log::info! calls in src/maker/api.rs (the blocks that reference
txid, failed_swap_ip, maker_clone and the spawned recovery thread) to include
the peer IP (ip), the swap id (use the swap identifier variable in scope, e.g.,
swap_id or similar), and the contract txid; do the same for the other recovery
log sites you noted (around lines ~690-698 and ~747-866) so every
warning/info/error emitted from the recovery path concatenates or formats ip,
swap id and txid consistently to identify which swap/peer triggered the message.

---

Outside diff comments:
In `@src/maker/api.rs`:
- Around line 919-934: The current info log prints the entire WatchResponse
transaction (variable transaction) which can leak witness preimages; change the
logging in the loop over responses to avoid serializing witness data — instead
log safe identifiers such as transaction.txid (or a short outpoint summary built
from each input's previous_output.txid and vout) and/or the input count; keep
the rest of the logic that checks input.witness and calls
update_swapcoins_with_preimages(maker, incomings, &preimages, true) /
update_swapcoins_with_preimages(maker, outgoings, &preimages, false) unchanged,
and ensure no witness bytes are included in the new log.

In `@src/maker/handlers.rs`:
- Around line 56-63: The legacy handler logs drop the swap identifier making
messages ambiguous; update all log calls in src/maker/handlers.rs that handle
legacy swap messages (including the block for
TakerToMakerMessage::WaitingFundingConfirmation and the other ranges mentioned)
to include the swap id/message.id like the Taproot handler does—e.g., change
log::info!("Reserved ... UTXOs") / "Prepared outgoing funding txs" /
"Broadcasted funding txs" to include the id variable (or message.id) in the log
string, and propagate that id through the same code paths (where functions or
closures reference id, use the existing id.clone() or message.id) so every
legacy log line prints the swap id for unambiguous tracing.

In `@src/maker/server.rs`:
- Around line 333-379: In handle_client, capture the client's peer address once
at the start (call stream.peer_addr() and store it) and include that peer
identifier in all subsequent logs within this function (e.g., the "Connection
ended.", "<=== {}", "===> {}", and any error logs including the MakerError
branches and IO send errors); update log lines around read_message,
serde_cbor::from_slice, send_message, and the MakerError match so they prepend
or interpolate the stored peer address to provide per-connection context while
leaving existing control flow and error handling unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: cdfb9b67-33ff-47c8-bbe8-7cea6f6ef2cc

📥 Commits

Reviewing files that changed from the base of the PR and between 06cf0a0 and 7a95389.

📒 Files selected for processing (7)
  • src/maker/api.rs
  • src/maker/api2.rs
  • src/maker/handlers.rs
  • src/maker/handlers2.rs
  • src/maker/rpc/server.rs
  • src/maker/server.rs
  • src/maker/server2.rs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/maker/api.rs`:
- Around line 882-892: The code computes anchor_id inside the loop even though
it is loop-invariant; move the anchor_id computation out of the loop in the
Maker timelock recovery logic (same fix as recover_via_hashlock) by computing
let anchor_id = outgoing.first().map(|c|
c.contract_tx.compute_txid().to_string()).unwrap_or_default(); once before the
loop that references broadcasted and outgoing, then use that anchor_id in the
log::info! call(s) instead of recomputing it each iteration.
- Around line 822-832: Compute anchor_id once before the loop instead of
recomputing inside each iteration: move the call to incoming.first().map(|c|
c.contract_tx.compute_txid().to_string()).unwrap_or_default() out of the loop
and store it in a local variable named anchor_id, then use that anchor_id in the
existing log::info! call (the log invocation that references "[Contract: {}]
Maker hashlock recovery: ..."). This avoids repeatedly calling compute_txid() on
the same incoming.first() value during each loop iteration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fe478128-84c3-4ad1-8ff9-9760466357f9

📥 Commits

Reviewing files that changed from the base of the PR and between 7a95389 and b39e910.

📒 Files selected for processing (1)
  • src/maker/api.rs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/maker/api.rs`:
- Around line 873-881: The method chain indentation for calling
broadcast_outgoing_contracts on maker.wallet.write() is inconsistent; reformat
the chain so it matches the project's style (each chained call on its own
indented line) for the expression that assigns infos (the call sequence
maker.wallet.write()?.broadcast_outgoing_contracts(outgoing.clone())?) and
ensure the following anchor_id assignment using
outgoing.first().map(...).unwrap_or_default() remains aligned with surrounding
code (e.g., mirror the layout used in recover_via_hashlock).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 35250f00-20bd-4a87-9f66-722c45b4e95c

📥 Commits

Reviewing files that changed from the base of the PR and between b39e910 and 79e060c.

📒 Files selected for processing (1)
  • src/maker/api.rs

@Abhishek2634 Abhishek2634 force-pushed the cleanup/remove-network-port branch from 79e060c to 449c555 Compare March 14, 2026 12:05
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/maker/handlers.rs (1)

56-63: ⚠️ Potential issue | 🟡 Minor

Restore the swap id in this timer-reset log.

id is already in scope, and without the old port prefix this line no longer tells you which swap's timer was touched.

Suggested fix
-        log::info!("Taker is waiting for funding confirmation. Resetting timer.",);
+        log::info!(
+            "[Swap: {}] Taker is waiting for funding confirmation. Resetting timer.",
+            id
+        );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/maker/handlers.rs` around lines 56 - 63, The log message inside the match
arm for TakerToMakerMessage::WaitingFundingConfirmation should include the swap
id so you know which timer was reset; update the log::info! call in that arm to
print the id (e.g. log::info!("Taker is waiting for funding confirmation for
swap {}. Resetting timer.", id);) before modifying
maker.ongoing_swap_state.lock()? and returning Ok(None).
♻️ Duplicate comments (1)
src/maker/api.rs (1)

755-799: ⚠️ Potential issue | 🟡 Minor

Keep anchor_txid on the follow-up recovery logs.

recover_from_swap can run concurrently. After the initial [Contract: ...] line, the timelock expired... and all preimages known... messages drop that anchor, so the recovery phase becomes ambiguous again.

Suggested fix
         if current_height >= timelock_expiry {
             log::info!(
-                "timelock expired at {} (expiry={}), using timelock path",
+                "[Contract: {}] timelock expired at {} (expiry={}), using timelock path",
+                anchor_txid,
                 current_height,
                 timelock_expiry
             );
             return recover_via_timelock(maker, outgoing_swapcoins);
         }
@@
         if all_preimages_known {
             log::info!(
-                "all preimages known at height {}, using hashlock path",
+                "[Contract: {}] all preimages known at height {}, using hashlock path",
+                anchor_txid,
                 current_height
             );
             return recover_via_hashlock(maker, incoming_swapcoins);
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/maker/api.rs` around lines 755 - 799, The follow-up logs in
recover_from_swap drop the anchor_txid context; update the two log::info calls
that currently print "timelock expired..." and "all preimages known..." to
include the anchor_txid (the variable defined earlier) in their format string
(e.g. prefix with "[Contract: {}]" and pass anchor_txid) so those messages keep
the same contract context as the initial log; ensure you modify the log::info
invocations before calling recover_via_timelock and recover_via_hashlock
respectively.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/maker/handlers2.rs`:
- Around line 201-204: Update the two info logs that currently only print
swap_id so they include the protocol id (senders_contract.id) as well; e.g.
change the "Persisted incoming and outgoing swapcoins with swap_id={}" log to
include both senders_contract.id and swap_id in the message, and make the same
change for the other similar log at the nearby block (lines 207-210) so both
logs show "protocol_id={}" and "swap_id={}" together for easier
cross-referencing.

In `@src/maker/server.rs`:
- Around line 517-523: Accept currently throws away the peer address from
listener.accept(), which removes the per-session identifier and makes logs from
handle_client and its internal errors ambiguous; capture the peer address (e.g.,
let (mut stream, addr) = listener.accept() or rename to addr) and thread that
identifier into handle_client by updating its signature (e.g.,
handle_client(maker: &MakerType, stream: &mut TcpStream, peer: SocketAddr)) and
all internal logging sites so each log line (including "Connection ended", the
"<===", "===>", and error logs inside handle_client) includes the same peer
identifier for clear attribution across messages and sessions.

---

Outside diff comments:
In `@src/maker/handlers.rs`:
- Around line 56-63: The log message inside the match arm for
TakerToMakerMessage::WaitingFundingConfirmation should include the swap id so
you know which timer was reset; update the log::info! call in that arm to print
the id (e.g. log::info!("Taker is waiting for funding confirmation for swap {}.
Resetting timer.", id);) before modifying maker.ongoing_swap_state.lock()? and
returning Ok(None).

---

Duplicate comments:
In `@src/maker/api.rs`:
- Around line 755-799: The follow-up logs in recover_from_swap drop the
anchor_txid context; update the two log::info calls that currently print
"timelock expired..." and "all preimages known..." to include the anchor_txid
(the variable defined earlier) in their format string (e.g. prefix with
"[Contract: {}]" and pass anchor_txid) so those messages keep the same contract
context as the initial log; ensure you modify the log::info invocations before
calling recover_via_timelock and recover_via_hashlock respectively.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7e6c0dba-173e-4e06-9611-25fe739a62e6

📥 Commits

Reviewing files that changed from the base of the PR and between 79e060c and 449c555.

📒 Files selected for processing (7)
  • src/maker/api.rs
  • src/maker/api2.rs
  • src/maker/handlers.rs
  • src/maker/handlers2.rs
  • src/maker/rpc/server.rs
  • src/maker/server.rs
  • src/maker/server2.rs

@Abhishek2634
Copy link
Author

Hi @mojoX911 , @hulxv

Ready for review.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/maker/server.rs (1)

349-380: ⚠️ Potential issue | 🟡 Minor

Keep peer attribution consistent across all handle_client error logs.

Lines 349, 366, 376, and 379 still log without [Peer: {}], so concurrent-session error attribution is still incomplete.

🧭 Suggested fix
-                        log::error!("Net Error: {}", e);
+                        log::error!("[Peer: {}] Net Error: {}", addr, e);
@@
-                        log::error!("Closing due to IO error in sending message: {e:?}");
+                        log::error!(
+                            "[Peer: {}] Closing due to IO error in sending message: {e:?}",
+                            addr
+                        );
@@
-                        log::error!("Maker Special Behavior Triggered Disconnection : {:?}", sp);
+                        log::error!(
+                            "[Peer: {}] Maker Special Behavior Triggered Disconnection: {:?}",
+                            addr,
+                            sp
+                        );
@@
-                        log::error!("Internal message handling error occurred: {:?}", e);
+                        log::error!(
+                            "[Peer: {}] Internal message handling error occurred: {:?}",
+                            addr,
+                            e
+                        );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/maker/server.rs` around lines 349 - 380, Update the error log statements
inside the handle_client loop to include the peer attribution like the other
logs: prefix each log::error! at the locations that currently log without
"[Peer: {}]" (the IO send error path around send_message, the
MakerError::SpecialBehaviour branch, and the generic Err branch after
handle_message) to use the same format string with "[Peer: {}]" and pass addr as
the first formatter argument so all errors consistently show the peer (use the
same logging style as the existing log::info!("[Peer: {}] ...", addr, ...)).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/maker/handlers2.rs`:
- Line 34: The debug log currently prints the entire TakerToMakerMessage (via
log::debug!("Handling message: {:?}", message)) which can leak secrets for the
PrivateKeyHandover variant; change the debug site to first convert the message
into a redacted form (e.g., match on TakerToMakerMessage and for
PrivateKeyHandover replace the sensitive payload with a fixed "[REDACTED]"
string or build a shallow redacted copy) and then log that redacted
representation instead; implement a small helper like
redacted_message_for_log(&TakerToMakerMessage) or a Display/Debug wrapper and
use it in the log::debug! call so only non-sensitive fields are printed while
PrivateKeyHandover payloads are omitted.
- Around line 64-71: After processing the taproot private key handover in
handle_privkey_handover, call Maker::sweep_after_successful_coinswap() and then
persist wallet state via maker.wallet().sync_and_save() (or the equivalent
sync_and_save method used in handlers.rs) before returning the
MakerToTakerMessage; specifically, after let response =
maker.process_private_key_handover(&privkey_handover, connection_state)? insert
a call to maker.sweep_after_successful_coinswap()? and then
maker.wallet().sync_and_save()? (or the corresponding methods on Maker) so the
taproot path mirrors the legacy handlers.rs behavior.

---

Duplicate comments:
In `@src/maker/server.rs`:
- Around line 349-380: Update the error log statements inside the handle_client
loop to include the peer attribution like the other logs: prefix each
log::error! at the locations that currently log without "[Peer: {}]" (the IO
send error path around send_message, the MakerError::SpecialBehaviour branch,
and the generic Err branch after handle_message) to use the same format string
with "[Peer: {}]" and pass addr as the first formatter argument so all errors
consistently show the peer (use the same logging style as the existing
log::info!("[Peer: {}] ...", addr, ...)).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 66b9f06b-98a9-4364-b73a-977a79569023

📥 Commits

Reviewing files that changed from the base of the PR and between 449c555 and 2e1399b.

📒 Files selected for processing (2)
  • src/maker/handlers2.rs
  • src/maker/server.rs

@Abhishek2634
Copy link
Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 15, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mojoX911
Copy link

The part of the issue also described to find a new identifier for the makers. Just removing them is not enough. We need to add an alternate identifier in its place.

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.

feat: Remove network as maker identifier

2 participants