Skip to content

loopin: Route invoices over asset channels - #1212

Open
sputn1ck wants to merge 5 commits into
masterfrom
kon/asset-loop-in-invoices
Open

loopin: Route invoices over asset channels#1212
sputn1ck wants to merge 5 commits into
masterfrom
kon/asset-loop-in-invoices

Conversation

@sputn1ck

@sputn1ck sputn1ck commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

  • expose an asset ID and optional asset edge node on Loop In RPC and CLI
    requests
  • create the swap and probe invoices through tapd, pin both to the
    negotiated asset edge, and pass that peer to the server as the final hop
  • validate incompatible invoice-routing options and cover invoice creation,
    peer selection, and request validation

Testing

  • GOWORK=off go test ./...
  • GOWORK=off make lint workers=4
  • GOWORK=off make rpc
  • GOWORK=off make docs-check
  • GOWORK=off make commitmsg-lint range="origin/master..HEAD"

Pull Request Checklist

  • Added an entry to docs/release-notes/release-notes-next.md

Wrap tapd's asset-aware invoice RPC so Loop In can create regular and
hold invoices payable through a selected asset channel.
Create Loop In swap and probe invoices through tapd, pin both invoices
to the negotiated asset edge, and pass that edge to the server as the
final hop.
Let RPC and CLI callers select an asset and optional channel peer for
Loop In while preserving the existing BTC invoice behavior by default.
Record the new Taproot Asset invoice path in the next Loop release
notes.
Copilot AI lite review requested due to automatic review settings August 26, 2026 12:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extends Loop In to support routing swap/probe invoices over Taproot Asset channels by exposing asset routing parameters on the Loop In RPC/CLI and creating the invoices via tapd, pinned to the negotiated asset edge peer.

Changes:

  • Add asset_info (asset ID + optional asset edge node) to Loop In RPC/Swagger/CLI, and validate incompatible routing options.
  • Update Loop In swap initiation to create both swap and probe invoices through tapd when asset_info is set, pinning server payment/probe to the negotiated edge peer.
  • Add test coverage for asset invoice creation, peer pinning, and request validation; update session fixtures and release notes.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
server_mock_test.go Extend mock server to capture Loop In last-hop and initiator passed during swap creation.
looprpc/client.swagger.json Document new Loop In asset_info fields in the REST/Swagger surface.
looprpc/client.proto Add AssetLoopInRequest and LoopInRequest.asset_info to the public RPC API.
looprpc/client.pb.go Regenerated protobuf bindings to include the new Loop In asset_info message/field.
loopin.go Implement asset-aware Loop In flow: validate options and create swap/probe invoices via tapd.
loopin_test.go Add tests verifying tapd invoice creation, peer pinning, and request validation for asset Loop Ins.
loopd/swapclient_server.go Parse/validate asset_info on the daemon RPC boundary and map into internal LoopInRequest.
interface.go Extend internal LoopInRequest with AssetId and AssetEdgeNode.
docs/release-notes/release-notes-next.md Add release note entry for Taproot Asset channel invoice routing in Loop In.
cmd/loop/testdata/sessions/loopin/06_loop-in-external-force.json Update CLI golden session output to include asset_info.
cmd/loop/testdata/sessions/basic-swaps/02_loop-in.json Update CLI golden session output to include asset_info.
cmd/loop/loopin.go Add CLI flags for asset loop-ins and plumb asset_info into the Loop In RPC request.
client.go Improve logging/validation around asset loop-in usage in the client entrypoint.
assets/client.go Add TapdClient.AddAssetInvoice helper to create (hold) invoices via tapd asset channels.
assets/client_test.go Add tests for AddAssetInvoice covering hold vs regular invoice and incomplete responses.
Files not reviewed (1)
  • looprpc/client.pb.go: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/loop/loopin.go
Comment on lines +176 to +189
assetID, err := hex.DecodeString(cmd.String("asset_id"))
if err != nil {
return fmt.Errorf("invalid asset id: %w", err)
}

var assetEdgeNode []byte
if cmd.IsSet("asset_edge_node") {
assetEdgeNode, err = hex.DecodeString(
cmd.String("asset_edge_node"),
)
if err != nil {
return fmt.Errorf("invalid asset edge node: %w", err)
}
}
Include the new asset Loop In flags in the generated man page and
Markdown command reference.
@sputn1ck

Copy link
Copy Markdown
Member Author

/gateway review

@lightninglabs-gateway

Copy link
Copy Markdown

👀 gateway review starting…

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.

2 participants