loopin: Route invoices over asset channels - #1212
Open
sputn1ck wants to merge 5 commits into
Open
Conversation
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.
There was a problem hiding this comment.
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
tapdwhenasset_infois 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 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.
Member
Author
|
/gateway review |
|
👀 gateway review starting… |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
requests
tapd, pin both to thenegotiated asset edge, and pass that peer to the server as the final hop
peer selection, and request validation
Testing
GOWORK=off go test ./...GOWORK=off make lint workers=4GOWORK=off make rpcGOWORK=off make docs-checkGOWORK=off make commitmsg-lint range="origin/master..HEAD"Pull Request Checklist
docs/release-notes/release-notes-next.md