diff --git a/docs/release-notes/release-notes-0.7.0.md b/docs/release-notes/release-notes-0.7.0.md index 5ea2e3ade..5ab6dac24 100644 --- a/docs/release-notes/release-notes-0.7.0.md +++ b/docs/release-notes/release-notes-0.7.0.md @@ -73,6 +73,14 @@ [related PR](https://github.com/lightninglabs/taproot-assets/pull/1613) for more info. +- Asset HTLCs that are received or sent do not shift the satoshi balance of the + channel. This is because now the default behavior is to use + [Noop HTLCs](https://github.com/lightninglabs/taproot-assets/pull/1567) which + lock some above-dust sats amount with the HTLC as long as it's in-flight, but + nullifies it upon settlement. This is currently hidden behind the dev build + tag and also needs to be toggled on via the `channel.noop-htlcs` configuration + option. + ## RPC Additions - The [price oracle RPC calls now have an intent, optional peer ID and metadata diff --git a/go.mod b/go.mod index c52da00ec..40be67915 100644 --- a/go.mod +++ b/go.mod @@ -9,8 +9,8 @@ require ( github.com/btcsuite/btcd/btcutil/psbt v1.1.10 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c - github.com/btcsuite/btclog/v2 v2.0.1-0.20250602222548-9967d19bb084 - github.com/btcsuite/btcwallet v0.16.14 + github.com/btcsuite/btclog/v2 v2.0.1-0.20250728225537-6090e87c6c5b + github.com/btcsuite/btcwallet v0.16.15-0.20250805011126-a3632ae48ab3 github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 github.com/btcsuite/btcwallet/wtxmgr v1.5.6 github.com/caddyserver/certmagic v0.17.2 @@ -30,7 +30,7 @@ require ( github.com/lightninglabs/lndclient v0.19.0-9 github.com/lightninglabs/neutrino/cache v1.1.2 github.com/lightninglabs/taproot-assets/taprpc v1.0.9 - github.com/lightningnetwork/lnd v0.19.2-beta + github.com/lightningnetwork/lnd v0.19.3-beta.rc1.0.20250812194315-c3226e8c2223 github.com/lightningnetwork/lnd/cert v1.2.2 github.com/lightningnetwork/lnd/clock v1.1.1 github.com/lightningnetwork/lnd/fn/v2 v2.0.8 @@ -41,11 +41,11 @@ require ( github.com/prometheus/client_golang v1.14.0 github.com/stretchr/testify v1.10.0 github.com/urfave/cli v1.22.14 - golang.org/x/crypto v0.36.0 + golang.org/x/crypto v0.37.0 golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 - golang.org/x/net v0.38.0 - golang.org/x/sync v0.12.0 - golang.org/x/term v0.30.0 + golang.org/x/net v0.39.0 + golang.org/x/sync v0.13.0 + golang.org/x/term v0.31.0 golang.org/x/time v0.5.0 google.golang.org/grpc v1.64.1 google.golang.org/protobuf v1.34.2 @@ -81,8 +81,8 @@ require ( github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect github.com/decred/dcrd/lru v1.1.2 // indirect - github.com/docker/cli v28.0.1+incompatible // indirect - github.com/docker/docker v28.0.1+incompatible // indirect + github.com/docker/cli v28.1.1+incompatible // indirect + github.com/docker/docker v28.1.1+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -108,12 +108,12 @@ require ( github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgproto3/v2 v2.3.3 // indirect - github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect - github.com/jackc/pgtype v1.14.0 // indirect - github.com/jackc/pgx/v4 v4.18.2 // indirect - github.com/jackc/pgx/v5 v5.5.4 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/pgtype v1.14.4 // indirect + github.com/jackc/pgx/v4 v4.18.3 // indirect + github.com/jackc/pgx/v5 v5.7.4 // indirect github.com/jackc/puddle v1.3.0 // indirect - github.com/jackc/puddle/v2 v2.2.1 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect github.com/jackpal/gateway v1.0.5 // indirect github.com/jackpal/go-nat-pmp v0.0.0-20170405195558-28a68d0c24ad // indirect github.com/jonboulle/clockwork v0.2.2 // indirect @@ -132,7 +132,7 @@ require ( github.com/lightningnetwork/lnd/healthcheck v1.2.6 // indirect github.com/lightningnetwork/lnd/kvdb v1.4.16 // indirect github.com/lightningnetwork/lnd/queue v1.1.1 // indirect - github.com/lightningnetwork/lnd/sqldb v1.0.10 // indirect + github.com/lightningnetwork/lnd/sqldb v1.0.10-0.20250812192515-dd1d57d82de1 // indirect github.com/lightningnetwork/lnd/ticker v1.1.1 // indirect github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 // indirect github.com/mattn/go-isatty v0.0.20 // indirect @@ -190,8 +190,8 @@ require ( go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.23.0 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/sys v0.31.0 // indirect - golang.org/x/text v0.23.0 // indirect + golang.org/x/sys v0.32.0 // indirect + golang.org/x/text v0.24.0 // indirect golang.org/x/tools v0.24.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 // indirect diff --git a/go.sum b/go.sum index 7f4d47190..9b566bedc 100644 --- a/go.sum +++ b/go.sum @@ -666,11 +666,11 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtyd github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c h1:4HxD1lBUGUddhzgaNgrCPsFWd7cGYNpeFUgd9ZIgyM0= github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c/go.mod h1:w7xnGOhwT3lmrS4H3b/D1XAXxvh+tbhUm8xeHN2y3TQ= -github.com/btcsuite/btclog/v2 v2.0.1-0.20250602222548-9967d19bb084 h1:y3bvkt8ki0KX35eUEU8XShRHusz1S+55QwXUTmxn888= -github.com/btcsuite/btclog/v2 v2.0.1-0.20250602222548-9967d19bb084/go.mod h1:XItGUfVOxotJL8kkuk2Hj3EVow5KCugXl3wWfQ6K0AE= +github.com/btcsuite/btclog/v2 v2.0.1-0.20250728225537-6090e87c6c5b h1:MQ+Q6sDy37V1wP1Yu79A5KqJutolqUGwA99UZWQDWZM= +github.com/btcsuite/btclog/v2 v2.0.1-0.20250728225537-6090e87c6c5b/go.mod h1:XItGUfVOxotJL8kkuk2Hj3EVow5KCugXl3wWfQ6K0AE= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcwallet v0.16.14 h1:CofysgmI1ednkLsXontAdBoXJkbiim7unXnFKhLLjnE= -github.com/btcsuite/btcwallet v0.16.14/go.mod h1:H6dfoZcWPonM2wbVsR2ZBY0PKNZKdQyLAmnX8vL9JFA= +github.com/btcsuite/btcwallet v0.16.15-0.20250805011126-a3632ae48ab3 h1:MAjNRpj3XhCOrhchq4wq0qI34TIBX/DCnT6OLWejx68= +github.com/btcsuite/btcwallet v0.16.15-0.20250805011126-a3632ae48ab3/go.mod h1:H6dfoZcWPonM2wbVsR2ZBY0PKNZKdQyLAmnX8vL9JFA= github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 h1:Rr0njWI3r341nhSPesKQ2JF+ugDSzdPoeckS75SeDZk= github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5/go.mod h1:+tXJ3Ym0nlQc/iHSwW1qzjmPs3ev+UVWMbGgfV1OZqU= github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 h1:YEO+Lx1ZJJAtdRrjuhXjWrYsmAk26wLTlNzxt2q0lhk= @@ -758,10 +758,10 @@ github.com/dhui/dktest v0.4.5 h1:uUfYBIVREmj/Rw6MvgmqNAYzTiKOHJak+enB5Di73MM= github.com/dhui/dktest v0.4.5/go.mod h1:tmcyeHDKagvlDrz7gDKq4UAJOLIfVZYkfD5OnHDwcCo= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/cli v28.0.1+incompatible h1:g0h5NQNda3/CxIsaZfH4Tyf6vpxFth7PYl3hgCPOKzs= -github.com/docker/cli v28.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/docker v28.0.1+incompatible h1:FCHjSRdXhNRFjlHMTv4jUNlIBbTeRjrWfeFuJp7jpo0= -github.com/docker/docker v28.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/cli v28.1.1+incompatible h1:eyUemzeI45DY7eDPuwUcmDyDj1pM98oD5MdSpiItp8k= +github.com/docker/cli v28.1.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/docker v28.1.1+incompatible h1:49M11BFLsVO1gxY9UX9p/zwkE/rswggs8AdFmXQw51I= +github.com/docker/docker v28.1.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -1029,29 +1029,32 @@ github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwX github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUOag= github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgtype v1.14.0 h1:y+xUdabmyMkJLyApYuPj38mW+aAIqCe5uuBB51rH3Vw= github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgtype v1.14.4 h1:fKuNiCumbKTAIxQwXfB/nsrnkEI6bPJrrSiMKgbJ2j8= +github.com/jackc/pgtype v1.14.4/go.mod h1:aKeozOde08iifGosdJpz9MBZonJOUJxqNpPBcMJTlVA= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.18.2 h1:xVpYkNR5pk5bMCZGfClbO962UIqVABcAGt7ha1s/FeU= github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= -github.com/jackc/pgx/v5 v5.5.4 h1:Xp2aQS8uXButQdnCMWNmvx6UysWQQC+u1EoizjguY+8= -github.com/jackc/pgx/v5 v5.5.4/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= +github.com/jackc/pgx/v4 v4.18.3 h1:dE2/TrEsGX3RBprb3qryqSV9Y60iZN1C6i8IrmW9/BA= +github.com/jackc/pgx/v4 v4.18.3/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= +github.com/jackc/pgx/v5 v5.7.4 h1:9wKznZrhWa2QiHL+NjTSPP6yjl3451BX3imWDnokYlg= +github.com/jackc/pgx/v5 v5.7.4/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.3.0 h1:eHK/5clGOatcjX3oWGBO/MpxpbHzSwud5EWTSCI+MX0= github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= -github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= github.com/jackpal/go-nat-pmp v0.0.0-20170405195558-28a68d0c24ad h1:heFfj7z0pGsNCekUlsFhO2jstxO4b5iQ665LjwM5mDc= @@ -1149,8 +1152,8 @@ github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display h1:w7FM5LH9 github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb h1:yfM05S8DXKhuCBp5qSMZdtSwvJ+GFzl94KbXMNB1JDY= github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI= -github.com/lightningnetwork/lnd v0.19.2-beta h1:3SKVrKYFY4IJLlrMf7cDzZcBeT+MxjI9Xy6YpY+EEX4= -github.com/lightningnetwork/lnd v0.19.2-beta/go.mod h1:+yKUfIGKKYRHGewgzQ6xi0S26DIfBiMv1zCdB3m6YxA= +github.com/lightningnetwork/lnd v0.19.3-beta.rc1.0.20250812194315-c3226e8c2223 h1:CBN1ju+LQL+jTfneGabUTFoHYuAnFeHv3j5+09wtOCo= +github.com/lightningnetwork/lnd v0.19.3-beta.rc1.0.20250812194315-c3226e8c2223/go.mod h1:MNRzea8Yrgk+ohyUhK7JSpoigE4T9JgerMQQUxMbl9I= github.com/lightningnetwork/lnd/cert v1.2.2 h1:71YK6hogeJtxSxw2teq3eGeuy4rHGKcFf0d0Uy4qBjI= github.com/lightningnetwork/lnd/cert v1.2.2/go.mod h1:jQmFn/Ez4zhDgq2hnYSw8r35bqGVxViXhX6Cd7HXM6U= github.com/lightningnetwork/lnd/clock v1.1.1 h1:OfR3/zcJd2RhH0RU+zX/77c0ZiOnIMsDIBjgjWdZgA0= @@ -1163,8 +1166,8 @@ github.com/lightningnetwork/lnd/kvdb v1.4.16 h1:9BZgWdDfjmHRHLS97cz39bVuBAqMc4/p github.com/lightningnetwork/lnd/kvdb v1.4.16/go.mod h1:HW+bvwkxNaopkz3oIgBV6NEnV4jCEZCACFUcNg4xSjM= github.com/lightningnetwork/lnd/queue v1.1.1 h1:99ovBlpM9B0FRCGYJo6RSFDlt8/vOkQQZznVb18iNMI= github.com/lightningnetwork/lnd/queue v1.1.1/go.mod h1:7A6nC1Qrm32FHuhx/mi1cieAiBZo5O6l8IBIoQxvkz4= -github.com/lightningnetwork/lnd/sqldb v1.0.10 h1:ZLV7TGwjnKupVfCd+DJ43MAc9BKVSFCnvhpSPGKdN3M= -github.com/lightningnetwork/lnd/sqldb v1.0.10/go.mod h1:c/vWoQfcxu6FAfHzGajkIQi7CEIeIZFhhH4DYh1BJpc= +github.com/lightningnetwork/lnd/sqldb v1.0.10-0.20250812192515-dd1d57d82de1 h1:Qf0lRLvj5xmcJGIRlREPi0c1h9fMxGe2u098Hn13eAc= +github.com/lightningnetwork/lnd/sqldb v1.0.10-0.20250812192515-dd1d57d82de1/go.mod h1:c/vWoQfcxu6FAfHzGajkIQi7CEIeIZFhhH4DYh1BJpc= github.com/lightningnetwork/lnd/ticker v1.1.1 h1:J/b6N2hibFtC7JLV77ULQp++QLtCwT6ijJlbdiZFbSM= github.com/lightningnetwork/lnd/ticker v1.1.1/go.mod h1:waPTRAAcwtu7Ji3+3k+u/xH5GHovTsCoSVpho0KDvdA= github.com/lightningnetwork/lnd/tlv v1.3.2 h1:MO4FCk7F4k5xPMqVZF6Nb/kOpxlwPrUQpYjmyKny5s0= @@ -1459,8 +1462,10 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= +golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= +golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1592,8 +1597,10 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= -golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= +golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1640,8 +1647,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= -golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= +golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1742,8 +1749,10 @@ golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= +golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1753,8 +1762,10 @@ golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= -golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o= +golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1771,8 +1782,9 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= +golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/rfq/manager.go b/rfq/manager.go index 1d1377e1f..3faf5406f 100644 --- a/rfq/manager.go +++ b/rfq/manager.go @@ -123,6 +123,10 @@ type ManagerCfg struct { // messages (this means that the price oracle will not be queried). SkipAcceptQuotePriceCheck bool + // NoOpHTLCs is a boolean indicating whether the daemon configuration + // wants us to produce NoOp HTLCs. + NoOpHTLCs bool + // ErrChan is the main error channel which will be used to report back // critical errors to the main server. ErrChan chan<- error @@ -244,6 +248,7 @@ func (m *Manager) startSubsystems(ctx context.Context) error { HtlcSubscriber: m.cfg.HtlcSubscriber, AcceptHtlcEvents: m.acceptHtlcEvents, SpecifierChecker: m.AssetMatchesSpecifier, + NoOpHTLCs: m.cfg.NoOpHTLCs, }) if err != nil { return fmt.Errorf("error initializing RFQ order handler: %w", diff --git a/rfq/order.go b/rfq/order.go index c3bfcf9ee..e6c87e618 100644 --- a/rfq/order.go +++ b/rfq/order.go @@ -17,6 +17,7 @@ import ( "github.com/lightningnetwork/lnd/graph/db/models" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lnutils" + "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/tlv" ) @@ -120,13 +121,17 @@ type AssetSalePolicy struct { // that they carry. htlcToAmt map[models.CircuitKey]lnwire.MilliSatoshi + // NoOpHTLCs is a boolean indicating whether the daemon configuration + // wants us to produce NoOp HTLCs. + NoOpHTLCs bool + // expiry is the policy's expiry unix timestamp after which the policy // is no longer valid. expiry uint64 } // NewAssetSalePolicy creates a new asset sale policy. -func NewAssetSalePolicy(quote rfqmsg.BuyAccept) *AssetSalePolicy { +func NewAssetSalePolicy(quote rfqmsg.BuyAccept, noop bool) *AssetSalePolicy { htlcToAmtMap := make(map[models.CircuitKey]lnwire.MilliSatoshi) return &AssetSalePolicy{ @@ -136,6 +141,7 @@ func NewAssetSalePolicy(quote rfqmsg.BuyAccept) *AssetSalePolicy { AskAssetRate: quote.AssetRate.Rate, expiry: uint64(quote.AssetRate.Expiry.Unix()), htlcToAmt: htlcToAmtMap, + NoOpHTLCs: noop, } } @@ -284,6 +290,13 @@ func (c *AssetSalePolicy) GenerateInterceptorResponse( fn.None[[]rfqmsg.ID](), ) + // We are about to create an outgoing HTLC that carries assets. Let's + // set the noop flag in order to eventually only settle the assets but + // never settle the sats anchor amount that will carry them. + if c.NoOpHTLCs { + htlcRecord.SetNoopAdd(rfqmsg.UseNoOpHTLCs) + } + customRecords, err := lnwire.ParseCustomRecords(htlcRecord.Bytes()) if err != nil { return nil, fmt.Errorf("error parsing custom records: %w", err) @@ -669,6 +682,10 @@ type OrderHandlerCfg struct { // SpecifierChecker is an interface that contains methods for // checking certain properties related to asset specifiers. SpecifierChecker rfqmsg.SpecifierChecker + + // NoOpHTLCs is a boolean indicating whether the daemon configuration + // wants us to produce NoOp HTLCs. + NoOpHTLCs bool } // OrderHandler orchestrates management of accepted quote bundles. It monitors @@ -731,7 +748,21 @@ func (h *OrderHandler) handleIncomingHtlc(ctx context.Context, } if !ok { + noopTLV := uint64(lnwallet.NoOpHtlcTLVEntry.TypeVal()) + _, noopActive := htlc.InWireCustomRecords[noopTLV] + + // If we don't have a matching policy for this HTLC but the + // sender set the noop flag, that means we were about to push + // some outgoing sats amount that we would eventually never + // receive. The HTLC must be failed. + if noopActive { + return &lndclient.InterceptedHtlcResponse{ + Action: lndclient.InterceptorActionFail, + }, nil + } + log.Debug("Failed to find a policy for the HTLC. Resuming.") + return &lndclient.InterceptedHtlcResponse{ Action: lndclient.InterceptorActionResume, }, nil @@ -909,7 +940,7 @@ func (h *OrderHandler) RegisterAssetSalePolicy(buyAccept rfqmsg.BuyAccept) { log.Debugf("Order handler is registering an asset sale policy given a "+ "buy accept message: %s", buyAccept.String()) - policy := NewAssetSalePolicy(buyAccept) + policy := NewAssetSalePolicy(buyAccept, h.cfg.NoOpHTLCs) h.policies.Store(policy.AcceptedQuoteId.Scid(), policy) } diff --git a/rfqmsg/aux_features.go b/rfqmsg/aux_features.go new file mode 100644 index 000000000..97fb2d48f --- /dev/null +++ b/rfqmsg/aux_features.go @@ -0,0 +1,9 @@ +//go:build !dev + +package rfqmsg + +var ( + // UseNoOpHTLCs is set to false, as we don't want to enable it for + // production builds. + UseNoOpHTLCs = false +) diff --git a/rfqmsg/aux_features_dev.go b/rfqmsg/aux_features_dev.go new file mode 100644 index 000000000..81bae01c9 --- /dev/null +++ b/rfqmsg/aux_features_dev.go @@ -0,0 +1,8 @@ +//go:build dev + +package rfqmsg + +var ( + // UseNoOpHTLCs is set to true, as we want to enable it for dev builds. + UseNoOpHTLCs = true +) diff --git a/rfqmsg/records.go b/rfqmsg/records.go index ef683ec3e..3e50eb5b6 100644 --- a/rfqmsg/records.go +++ b/rfqmsg/records.go @@ -12,6 +12,7 @@ import ( "github.com/lightninglabs/taproot-assets/asset" "github.com/lightninglabs/taproot-assets/fn" "github.com/lightninglabs/taproot-assets/rfqmath" + "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/tlv" ) @@ -169,6 +170,13 @@ type Htlc struct { // picked when an HTLC is sent over to a peer. When one of these RFQ IDs // gets picked it will be encoded as an Htlc.RfqID (see above field). AvailableRfqIDs tlv.OptionalRecordT[AvailableRfqIDsType, HtlcRfqIDs] + + // NoopAdd is a flag that indicates whether this HTLC should be marked + // as a noop_add for LND. A noop_add HTLC behaves identically to a + // normal HTLC except for the settlement step, where the satoshi amount + // is returned back to the sender, but the commitment blob is still + // updated to reflect the asset balance changes. + NoopAdd bool } // NewHtlc creates a new Htlc record with the given funded assets. @@ -258,9 +266,19 @@ func (h *Htlc) Records() []tlv.Record { }, ) + if h.NoopAdd { + r := tlv.NewPrimitiveRecord[lnwallet.NoOpHtlcTLVType](true) + records = append(records, r.Record()) + } + return records } +// SetNoopAdd flags the HTLC as a noop_add. +func (h *Htlc) SetNoopAdd(noopActive bool) { + h.NoopAdd = noopActive +} + // Encode serializes the Htlc to the given io.Writer. func (h *Htlc) Encode(w io.Writer) error { tlvRecords := h.Records() diff --git a/sample-tapd.conf b/sample-tapd.conf index 45a715b24..08fa4c636 100644 --- a/sample-tapd.conf +++ b/sample-tapd.conf @@ -403,6 +403,12 @@ ; creating an address ; address.disable-syncer=false +[channel] + +; If set, all channels will default to using NoOp HTLCs. This type of HTLC will +; only move assets over the channel, but not any satoshi balance +; channel.noop-htlcs=false + [prometheus] ; If true prometheus metrics will be exported diff --git a/tapcfg/config.go b/tapcfg/config.go index e6c161f6c..58171b6f6 100644 --- a/tapcfg/config.go +++ b/tapcfg/config.go @@ -221,6 +221,10 @@ type ChainConfig struct { SigNetChallenge string `long:"signetchallenge" description:"Connect to a custom signet network defined by this challenge instead of using the global default signet test network -- Can be specified multiple times"` } +type ChannelConfig struct { + NoopHTLCs bool `long:"noop-htlcs" description:"toggles the use of noop HTLCs over tap channels"` +} + // RpcConfig houses the set of config options that affect how clients connect // to the main RPC server. type RpcConfig struct { @@ -357,6 +361,8 @@ type Config struct { AddrBook *AddrBookConfig `group:"address" namespace:"address"` + Channel *ChannelConfig `group:"channel" namespace:"channel"` + Prometheus monitoring.PrometheusConfig `group:"prometheus" namespace:"prometheus"` Experimental *ExperimentalConfig `group:"experimental" namespace:"experimental"` @@ -464,6 +470,9 @@ func DefaultConfig() Config { AddrBook: &AddrBookConfig{ DisableSyncer: false, }, + Channel: &ChannelConfig{ + NoopHTLCs: false, + }, Experimental: &ExperimentalConfig{ Rfq: rfq.CliConfig{ AcceptPriceDeviationPpm: rfq.DefaultAcceptPriceDeviationPpm, diff --git a/tapcfg/server.go b/tapcfg/server.go index 8469806fe..f11a39ac8 100644 --- a/tapcfg/server.go +++ b/tapcfg/server.go @@ -469,6 +469,7 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger, AcceptPriceDeviationPpm: rfqCfg.AcceptPriceDeviationPpm, // nolint: lll SkipAcceptQuotePriceCheck: rfqCfg.SkipAcceptQuotePriceCheck, + NoOpHTLCs: cfg.Channel.NoopHTLCs, ErrChan: mainErrChan, }, ) @@ -539,6 +540,7 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger, &tapchannel.TrafficShaperConfig{ ChainParams: &tapChainParams, RfqManager: rfqManager, + NoopHTLCs: cfg.Channel.NoopHTLCs, }, ) auxInvoiceManager := tapchannel.NewAuxInvoiceManager( diff --git a/tapchannel/aux_invoice_manager.go b/tapchannel/aux_invoice_manager.go index 62338f941..b0b667be1 100644 --- a/tapchannel/aux_invoice_manager.go +++ b/tapchannel/aux_invoice_manager.go @@ -17,6 +17,7 @@ import ( "github.com/lightningnetwork/lnd/invoices" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnutils" + "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/routing/route" ) @@ -196,7 +197,26 @@ func (s *AuxInvoiceManager) handleInvoiceAccept(ctx context.Context, resp.CancelSet = true } else { - iLog.Tracef("has no asset custom records, ignoring") + noopTLV := uint64(lnwallet.NoOpHtlcTLVEntry.TypeVal()) + _, isNoop := req.WireCustomRecords[noopTLV] + + // If the HTLC does not carry assets and the invoice is + // also not expecting assets then we do not want to + // modify anything as assets are not involved. If for + // any reason the noop flag is set (which is meant for + // asset HTLCs) we want to log a warning and cancel the + // HTLCs. Letting this HTLC through at this point means + // that we would be accounting a certain sats amount + // in favor of our invoice, without ever receiving that + // amount. + if isNoop { + resp.CancelSet = true + iLog.Warnf("sats HTLC without assets " + + "attempted a noop-add, cancelling set") + } else { + iLog.Tracef("has no asset custom records, " + + "ignoring") + } } return resp, nil diff --git a/tapchannel/aux_traffic_shaper.go b/tapchannel/aux_traffic_shaper.go index 1e0bea4fc..114b5344b 100644 --- a/tapchannel/aux_traffic_shaper.go +++ b/tapchannel/aux_traffic_shaper.go @@ -29,6 +29,10 @@ type TrafficShaperConfig struct { ChainParams *address.ChainParams RfqManager *rfq.Manager + + // NoOpHTLCs is a boolean indicating whether the daemon configuration + // wants us to produce NoOp HTLCs. + NoopHTLCs bool } // AuxTrafficShaper is a Taproot Asset auxiliary traffic shaper that can be used @@ -473,7 +477,17 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, if htlc.Amounts.Val.Sum() > 0 { log.Tracef("Already have asset amount (sum %d) in HTLC, not "+ "producing extra data", htlc.Amounts.Val.Sum()) - return totalAmount, htlcCustomRecords, nil + + if s.cfg.NoopHTLCs { + htlc.SetNoopAdd(rfqmsg.UseNoOpHTLCs) + } + + updatedRecords, err := htlc.ToCustomRecords() + if err != nil { + return 0, nil, err + } + + return totalAmount, updatedRecords, nil } // Within the context of a payment we may negotiate multiple quotes. All @@ -569,6 +583,14 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, // amount that should be sent on-chain, which is a value in satoshi that // is just above the dust limit. htlcAmountMSat := rfqmath.DefaultOnChainHtlcMSat + + // Now we set the flag that marks this HTLC as a noop_add, which means + // that the above dust will eventually return to us. This means that + // only the assets will be sent and not any btc balance. + if s.cfg.NoopHTLCs { + htlc.SetNoopAdd(rfqmsg.UseNoOpHTLCs) + } + updatedRecords, err := htlc.ToCustomRecords() if err != nil { return 0, nil, fmt.Errorf("error encoding HTLC blob: %w", err) diff --git a/tapchannel/commitment.go b/tapchannel/commitment.go index 547c84549..d802bed09 100644 --- a/tapchannel/commitment.go +++ b/tapchannel/commitment.go @@ -98,12 +98,12 @@ func ComputeView(ourBalance, theirBalance uint64, remoteHtlcIndex := make(map[uint64]lnwallet.AuxHtlcDescriptor) for _, entry := range original.Updates.Local { - if entry.EntryType == lnwallet.Add { + if entry.IsAdd() { localHtlcIndex[entry.HtlcIndex] = entry } } for _, entry := range original.Updates.Remote { - if entry.EntryType == lnwallet.Add { + if entry.IsAdd() { remoteHtlcIndex[entry.HtlcIndex] = entry } } @@ -115,6 +115,13 @@ func ComputeView(ourBalance, theirBalance uint64, case lnwallet.Add: continue + // Skip noop adds, they will also be processed below. This type + // of entry only settles the assets and not the sats that carry + // them. This is not something we have to worry about here since + // we only care about the assets at this point. + case lnwallet.NoOpAdd: + continue + // Fee updates don't concern us at the asset level. case lnwallet.FeeUpdate: continue @@ -162,6 +169,13 @@ func ComputeView(ourBalance, theirBalance uint64, case lnwallet.Add: continue + // Skip noop adds, they will also be processed below. This type + // of entry only settles the assets and not the sats that carry + // them. This is not something we have to worry about here since + // we only care about the assets at this point. + case lnwallet.NoOpAdd: + continue + // Fee updates don't concern us at the asset level. case lnwallet.FeeUpdate: continue @@ -207,7 +221,7 @@ func ComputeView(ourBalance, theirBalance uint64, // settled HTLCs, and debiting the chain state balance due to any newly // added HTLCs. for _, entry := range original.Updates.Local { - isAdd := entry.EntryType == lnwallet.Add + isAdd := entry.IsAdd() // Skip any entries that aren't adds or adds that were already // settled or failed by a child HTLC entry we processed above. @@ -249,7 +263,7 @@ func ComputeView(ourBalance, theirBalance uint64, newView.OurUpdates = append(newView.OurUpdates, decodedEntry) } for _, entry := range original.Updates.Remote { - isAdd := entry.EntryType == lnwallet.Add + isAdd := entry.IsAdd() // Skip any entries that aren't adds or adds that were already // settled or failed by a child HTLC entry we processed above.