Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ linters:
- wsl_v5
- noinlineerr
settings:
staticcheck:
checks:
- all
- -QF*
- -ST*
gosec:
excludes:
- G402
- G306
- G115
staticcheck:
checks:
- -SA1019
tagliatelle:
case:
rules:
Expand Down
2 changes: 1 addition & 1 deletion cmd/loop/loopin.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func loopIn(ctx context.Context, cmd *cli.Command) error {
}

fmt.Printf("Swap initiated\n")
fmt.Printf("ID: %v\n", resp.Id)
fmt.Printf("ID: %x\n", resp.IdBytes)

if resp.HtlcAddressP2Tr != "" {
fmt.Printf("HTLC address (P2TR): %v\n", resp.HtlcAddressP2Tr)
Expand Down
3 changes: 1 addition & 2 deletions cmd/loop/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"os/signal"
"path/filepath"
Expand Down Expand Up @@ -646,7 +645,7 @@ func getClientConn(address, tlsCertPath, macaroonPath string) (daemonConn,
// gRPC dial options from it.
func readMacaroon(macPath string) (grpc.DialOption, error) {
// Load the specified macaroon file.
macBytes, err := ioutil.ReadFile(macPath)
macBytes, err := os.ReadFile(macPath)
if err != nil {
return nil, fmt.Errorf("unable to read macaroon path : %v", err)
}
Expand Down
17 changes: 10 additions & 7 deletions cmd/loop/openchannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ import (
)

const (
defaultUtxoMinConf = 1
)

var (
defaultUtxoMinConf = 1
channelTypeTweakless = "tweakless"
channelTypeAnchors = "anchors"
channelTypeSimpleTaproot = "taproot"
channelTypeSimpleTaproot = "simple-taproot"
channelTypeTaproot = "taproot"
)

var openChannelCommand = &cli.Command{
Expand Down Expand Up @@ -137,9 +135,9 @@ var openChannelCommand = &cli.Command{
&cli.StringFlag{
Name: "channel_type",
Usage: fmt.Sprintf("(optional) the type of channel to "+
"propose to the remote peer (%q, %q, %q)",
"propose to the remote peer (%q, %q, %q, %q)",
channelTypeTweakless, channelTypeAnchors,
channelTypeSimpleTaproot),
channelTypeSimpleTaproot, channelTypeTaproot),
},
&cli.BoolFlag{
Name: "zero_conf",
Expand Down Expand Up @@ -322,6 +320,7 @@ func openChannel(ctx context.Context, cmd *cli.Command) error {
switch channelType {
case "":
break

case channelTypeTweakless:
req.CommitmentType = lnrpc.CommitmentType_STATIC_REMOTE_KEY

Expand All @@ -330,6 +329,10 @@ func openChannel(ctx context.Context, cmd *cli.Command) error {

case channelTypeSimpleTaproot:
req.CommitmentType = lnrpc.CommitmentType_SIMPLE_TAPROOT

case channelTypeTaproot:
req.CommitmentType = lnrpc.CommitmentType_TAPROOT

default:
return fmt.Errorf("unsupported channel type %v", channelType)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
" --max_local_csv uint (optional) the maximum number of blocks that we will allow the remote peer to require we wait before accessing our funds in the case of a unilateral close. (default: 0)\n",
" --close_address string (optional) an address to enforce payout of our funds to on cooperative close. Note that if this value is set on channel open, you will *not* be able to cooperatively close to a different address.\n",
" --remote_max_value_in_flight_msat uint (optional) the maximum value in msat that can be pending within the channel at any given time (default: 0)\n",
" --channel_type string (optional) the type of channel to propose to the remote peer (\"tweakless\", \"anchors\", \"taproot\")\n",
" --channel_type string (optional) the type of channel to propose to the remote peer (\"tweakless\", \"anchors\", \"simple-taproot\", \"taproot\")\n",
" --zero_conf (optional) whether a zero-conf channel open should be attempted. (default: false)\n",
" --scid_alias (optional) whether a scid-alias channel type should be negotiated. (default: false)\n",
" --remote_reserve_sats uint (optional) the minimum number of satoshis we require the remote node to keep as a direct payment. If not specified, a default of 1% of the channel capacity will be used. (default: 0)\n",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"metadata": {
"args": [
"/home/user/bin/loop",
"--rpcserver=localhost:11010",
"--loopdir=/redacted/loop",
"--tlscertpath=/redacted/loop/regtest/tls.cert",
"--macaroonpath=/redacted/loop/regtest/loop.macaroon",
"static",
"openchannel",
"--node_key",
"03465f68fd39358667678f8353a31e0d99475e3fd2fb4e58daf7dbfabe04c011f4",
"--fundmax",
"--utxo",
"89f6fd2ee96445c6e48278e7eaaca7de8e342904f20609ce72c0d27afb443e2d:1",
"--channel_type",
"taproot",
"--private",
"--network",
"regtest"
],
"env": {},
"version": "0.33.2-beta commit=v0.33.2-beta-bump-lnd-21-a-7-g21019e684ed06e2267382f473dfeaafb81a33310 commit_hash=21019e684ed06e2267382f473dfeaafb81a33310",
"duration": 295879956,
"clock_start_unix": 1782002722
},
"events": [
{
"time_ms": 2,
"kind": "grpc",
"data": {
"method": "/looprpc.SwapClient/StaticOpenChannel",
"event": "request",
"message_type": "looprpc.StaticOpenChannelRequest",
"payload": {
"open_channel_request": {
"sat_per_vbyte": "0",
"node_pubkey": "A0ZfaP05NYZnZ4+DU6MeDZlHXj/S+05Y2vfb+r4EwBH0",
"node_pubkey_string": "",
"local_funding_amount": "0",
"push_sat": "0",
"target_conf": 0,
"sat_per_byte": "0",
"private": true,
"min_htlc_msat": "0",
"remote_csv_delay": 0,
"min_confs": 1,
"spend_unconfirmed": false,
"close_address": "",
"funding_shim": null,
"remote_max_value_in_flight_msat": "0",
"remote_max_htlcs": 0,
"max_local_csv": 0,
"commitment_type": "TAPROOT",
"zero_conf": false,
"scid_alias": false,
"base_fee": "0",
"fee_rate": "0",
"use_base_fee": false,
"use_fee_rate": false,
"remote_chan_reserve_sat": "0",
"fund_max": true,
"memo": "",
"outpoints": [
{
"txid_bytes": "",
"txid_str": "89f6fd2ee96445c6e48278e7eaaca7de8e342904f20609ce72c0d27afb443e2d",
"output_index": 1
}
]
}
}
}
},
{
"time_ms": 295,
"kind": "grpc",
"data": {
"method": "/looprpc.SwapClient/StaticOpenChannel",
"event": "response",
"message_type": "looprpc.StaticOpenChannelResponse",
"payload": {
"channel_open_outpoint": "302a41b53946494306e415bdf4724e88b2cf2b37ad2f36dc075db00cc6499e9f:0"
}
}
},
{
"time_ms": 295,
"kind": "stdout",
"data": {
"lines": [
"{\n",
" \"channel_open_outpoint\": \"302a41b53946494306e415bdf4724e88b2cf2b37ad2f36dc075db00cc6499e9f:0\"\n",
"}\n"
]
}
},
{
"time_ms": 295,
"kind": "exit",
"data": {}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"metadata": {
"args": [
"/home/user/bin/loop",
"--rpcserver=localhost:11010",
"--loopdir=/redacted/loop",
"--tlscertpath=/redacted/loop/regtest/tls.cert",
"--macaroonpath=/redacted/loop/regtest/loop.macaroon",
"static",
"openchannel",
"--node_key",
"026eca9330cc3e589505c4a240ea1f7f551e5765b1aae9040c6667141da657eae6",
"--fundmax",
"--utxo",
"dc942b3252ded50abc30ef4e8614d392ab0f091acab75fdd09e18a07f6ac36e6:0",
"--channel_type",
"taproot",
"--private",
"--network",
"regtest"
],
"env": {},
"version": "0.33.3-beta commit= commit_hash=",
"run_error": "rpc error: code = Unknown desc = channel_type=taproot is not supported by the connected lnd; update LND to v0.21.0-beta or later to use this channel type: got error from server: rpc error: code = Unknown desc = unhandled request channel type 7",
"duration": 39639744,
"clock_start_unix": 1782158339
},
"events": [
{
"time_ms": 7,
"kind": "grpc",
"data": {
"method": "/looprpc.SwapClient/StaticOpenChannel",
"event": "request",
"message_type": "looprpc.StaticOpenChannelRequest",
"payload": {
"open_channel_request": {
"sat_per_vbyte": "0",
"node_pubkey": "Am7KkzDMPliVBcSiQOoff1UeV2WxqukEDGZnFB2mV+rm",
"node_pubkey_string": "",
"local_funding_amount": "0",
"push_sat": "0",
"target_conf": 0,
"sat_per_byte": "0",
"private": true,
"min_htlc_msat": "0",
"remote_csv_delay": 0,
"min_confs": 1,
"spend_unconfirmed": false,
"close_address": "",
"funding_shim": null,
"remote_max_value_in_flight_msat": "0",
"remote_max_htlcs": 0,
"max_local_csv": 0,
"commitment_type": "TAPROOT",
"zero_conf": false,
"scid_alias": false,
"base_fee": "0",
"fee_rate": "0",
"use_base_fee": false,
"use_fee_rate": false,
"remote_chan_reserve_sat": "0",
"fund_max": true,
"memo": "",
"outpoints": [
{
"txid_bytes": "",
"txid_str": "dc942b3252ded50abc30ef4e8614d392ab0f091acab75fdd09e18a07f6ac36e6",
"output_index": 0
}
]
}
}
}
},
{
"time_ms": 39,
"kind": "grpc",
"data": {
"method": "/looprpc.SwapClient/StaticOpenChannel",
"event": "error",
"error": "rpc error: code = Unknown desc = channel_type=taproot is not supported by the connected lnd; update LND to v0.21.0-beta or later to use this channel type: got error from server: rpc error: code = Unknown desc = unhandled request channel type 7",
"status": {
"code": 2,
"message": "channel_type=taproot is not supported by the connected lnd; update LND to v0.21.0-beta or later to use this channel type: got error from server: rpc error: code = Unknown desc = unhandled request channel type 7"
}
}
},
{
"time_ms": 39,
"kind": "stderr",
"data": {
"lines": [
"[loop] rpc error: code = Unknown desc = channel_type=taproot is not supported by the connected lnd; update LND to v0.21.0-beta or later to use this channel type: got error from server: rpc error: code = Unknown desc = unhandled request channel type 7\n"
]
}
},
{
"time_ms": 39,
"kind": "exit",
"data": {
"run_error": "rpc error: code = Unknown desc = channel_type=taproot is not supported by the connected lnd; update LND to v0.21.0-beta or later to use this channel type: got error from server: rpc error: code = Unknown desc = unhandled request channel type 7"
}
}
]
}
1 change: 1 addition & 0 deletions cost_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func MigrateLoopOutCosts(ctx context.Context, lnd lndclient.LndServices,
ctx, lndclient.ListPaymentsRequest{
Offset: offset,
MaxPayments: uint64(paymentBatchSize),
OmitHops: true,
},
)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions cost_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ func TestCostMigration(t *testing.T) {
// Now we can run the migration.
err = MigrateLoopOutCosts(context.Background(), lnd.LndServices, 1, store)
require.NoError(t, err)
listPaymentsRequests := lnd.ListPaymentsRequestsSnapshot()
require.NotEmpty(t, listPaymentsRequests)
for _, req := range listPaymentsRequests {
require.True(t, req.OmitHops)
}

// Finally check that the swap cost has been updated correctly.
swap, err := store.FetchLoopOutSwap(
Expand Down
2 changes: 1 addition & 1 deletion docs/loop.1
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ Open a channel to an existing peer.
\fB--base_fee_msat\fP="": the base fee in milli-satoshis that will be charged for each forwarded HTLC, regardless of payment size (default: 0)

.PP
\fB--channel_type\fP="": (optional) the type of channel to propose to the remote peer ("tweakless", "anchors", "taproot")
\fB--channel_type\fP="": (optional) the type of channel to propose to the remote peer ("tweakless", "anchors", "simple-taproot", "taproot")

.PP
\fB--close_address\fP="": (optional) an address to enforce payout of our funds to on cooperative close. Note that if this value is set on channel open, you will \fInot\fP be able to cooperatively close to a different address.
Expand Down
2 changes: 1 addition & 1 deletion docs/loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ The following flags are supported:
| `--max_local_csv="…"` | (optional) the maximum number of blocks that we will allow the remote peer to require we wait before accessing our funds in the case of a unilateral close | uint | `0` |
| `--close_address="…"` | (optional) an address to enforce payout of our funds to on cooperative close. Note that if this value is set on channel open, you will *not* be able to cooperatively close to a different address | string |
| `--remote_max_value_in_flight_msat="…"` | (optional) the maximum value in msat that can be pending within the channel at any given time | uint | `0` |
| `--channel_type="…"` | (optional) the type of channel to propose to the remote peer ("tweakless", "anchors", "taproot") | string |
| `--channel_type="…"` | (optional) the type of channel to propose to the remote peer ("tweakless", "anchors", "simple-taproot", "taproot") | string |
| `--zero_conf` | (optional) whether a zero-conf channel open should be attempted | bool | `false` |
| `--scid_alias` | (optional) whether a scid-alias channel type should be negotiated | bool | `false` |
| `--remote_reserve_sats="…"` | (optional) the minimum number of satoshis we require the remote node to keep as a direct payment. If not specified, a default of 1% of the channel capacity will be used | uint | `0` |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/jessevdk/go-flags v1.6.1
github.com/lib/pq v1.10.9
github.com/lightninglabs/aperture v0.4.0
github.com/lightninglabs/lndclient v0.21.0-1
github.com/lightninglabs/lndclient v0.21.0-2
github.com/lightninglabs/loop/looprpc v1.0.7
github.com/lightninglabs/loop/swapserverrpc v1.0.14
github.com/lightninglabs/taproot-assets v0.8.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1116,8 +1116,8 @@ github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf h1:HZKvJUHlcXI
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQPeIQxPf6Jf9rM8R+B4rKBqLA2AjttNxkFBL2Plk=
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.4-0.20250610182311-2f1d46ef18b7 h1:373o5lNr1udAdhcf5+zq/0dYpRtkvYLl8Lk6wG7I0DY=
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.4-0.20250610182311-2f1d46ef18b7/go.mod h1:bDnEKRN1u13NFBuy/C+bFLhxA5bfd3clT25y76QY0AM=
github.com/lightninglabs/lndclient v0.21.0-1 h1:NuyccCK7tbMaH7hhqtewcx+qeBel4/RLJrlnQ/lMkkY=
github.com/lightninglabs/lndclient v0.21.0-1/go.mod h1:RUIcfPr82HrvZr3pu9f8nbD5v6VFbm+KgExqNNp5bE4=
github.com/lightninglabs/lndclient v0.21.0-2 h1:gA1utFMoKV6OZfHpYAQ1TX0wVs5cAtgTORRVavHR/ls=
github.com/lightninglabs/lndclient v0.21.0-2/go.mod h1:RUIcfPr82HrvZr3pu9f8nbD5v6VFbm+KgExqNNp5bE4=
github.com/lightninglabs/migrate/v4 v4.18.2-9023d66a-fork-pr-2.0.20251211093704-71c1eef09789 h1:7kX7vUgHUazAHcCJ6uzBDa4/2MEGEbMEfa01GtfqmTQ=
github.com/lightninglabs/migrate/v4 v4.18.2-9023d66a-fork-pr-2.0.20251211093704-71c1eef09789/go.mod h1:99BKpIi6ruaaXRM1A77eqZ+FWPQ3cfRa+ZVy5bmWMaY=
github.com/lightninglabs/neutrino v0.17.1 h1:lNhgq7ix/N81R6oATroP/kHMzH1qzVVF2dEGcTlN2t4=
Expand Down
5 changes: 4 additions & 1 deletion liquidity/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,11 @@ func RpcToParameters(req *clientrpc.LiquidityParameters) (*Parameters,
req.AutoloopBudgetSat != 0 {

params.AutoFeeRefreshPeriod = InfiniteDuration
// Keep reading the legacy start field so old stored
// liquidity parameters migrate to the refresh-period model.
budgetStartSec := req.AutoloopBudgetStartSec //nolint:staticcheck
params.AutoloopBudgetLastRefresh = time.Unix(
int64(req.AutoloopBudgetStartSec), 0)
int64(budgetStartSec), 0)
}

for _, rule := range req.Rules {
Expand Down
Loading
Loading