diff --git a/docs/examples/basic-price-oracle/go.mod b/docs/examples/basic-price-oracle/go.mod index 1909f32cc..e27b236a2 100644 --- a/docs/examples/basic-price-oracle/go.mod +++ b/docs/examples/basic-price-oracle/go.mod @@ -1,8 +1,6 @@ module basic-price-oracle -go 1.22 - -toolchain go1.22.3 +go 1.22.6 replace github.com/lightninglabs/taproot-assets => ../../../ @@ -15,7 +13,7 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - golang.org/x/net v0.23.0 // indirect + golang.org/x/net v0.24.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect diff --git a/docs/examples/basic-price-oracle/go.sum b/docs/examples/basic-price-oracle/go.sum index ab124ac0f..fd7dfd829 100644 --- a/docs/examples/basic-price-oracle/go.sum +++ b/docs/examples/basic-price-oracle/go.sum @@ -8,6 +8,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= diff --git a/go.mod b/go.mod index e417a2c61..aea026d6a 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,15 @@ module github.com/lightninglabs/taproot-assets -go 1.22 - -toolchain go1.22.3 +go 1.22.6 require ( - github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240403021926-ae5533602c46 + github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240625142744-cc26860b4026 github.com/btcsuite/btcd/btcec/v2 v2.3.3 github.com/btcsuite/btcd/btcutil v1.1.5 github.com/btcsuite/btcd/btcutil/psbt v1.1.8 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f - github.com/btcsuite/btcwallet v0.16.10-0.20240410030101-6fe19a472a62 + github.com/btcsuite/btcwallet v0.16.10-0.20240809133323-7d3434c65ae2 github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4 github.com/btcsuite/btcwallet/wtxmgr v1.5.3 github.com/caddyserver/certmagic v0.17.2 @@ -26,14 +24,14 @@ require ( github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438 github.com/jessevdk/go-flags v1.4.0 github.com/lib/pq v1.10.9 - github.com/lightninglabs/aperture v0.1.21-beta.0.20230705004936-87bb996a4030 + github.com/lightninglabs/aperture v0.3.2-beta.0.20240919071136-db27bb9a78bd github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2 - github.com/lightninglabs/lndclient v1.0.1-0.20240725080034-64a756aa4c36 + github.com/lightninglabs/lndclient v1.0.1-0.20240919113647-5bc7b3fa5a7d github.com/lightninglabs/neutrino/cache v1.1.2 - github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240723043204-f09d4042aee4 + github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240919095711-611852fd34b1 github.com/lightningnetwork/lnd/cert v1.2.2 github.com/lightningnetwork/lnd/clock v1.1.1 - github.com/lightningnetwork/lnd/fn v1.1.0 + github.com/lightningnetwork/lnd/fn v1.2.1 github.com/lightningnetwork/lnd/tlv v1.2.6 github.com/lightningnetwork/lnd/tor v1.1.2 github.com/ory/dockertest/v3 v3.10.0 @@ -41,8 +39,8 @@ require ( github.com/stretchr/testify v1.9.0 github.com/urfave/cli v1.22.9 golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 - golang.org/x/net v0.23.0 - golang.org/x/sync v0.6.0 + golang.org/x/net v0.24.0 + golang.org/x/sync v0.7.0 golang.org/x/term v0.19.0 golang.org/x/time v0.3.0 google.golang.org/grpc v1.59.0 @@ -79,7 +77,7 @@ require ( github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect github.com/decred/dcrd/lru v1.1.2 // indirect github.com/docker/cli v20.10.17+incompatible // indirect - github.com/docker/docker v24.0.7+incompatible // indirect + github.com/docker/docker v24.0.9+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -108,25 +106,26 @@ require ( 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.3.1 // indirect github.com/jackc/puddle v1.3.0 // 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 - github.com/jrick/logrotate v1.0.0 // indirect + github.com/jrick/logrotate v1.1.2 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4 // indirect github.com/kkdai/bstream v1.0.0 // indirect - github.com/klauspost/compress v1.15.11 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/libdns/libdns v0.2.1 // indirect github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect github.com/lightninglabs/lightning-node-connect v0.2.5-alpha // indirect github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd // indirect - github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f // indirect - github.com/lightningnetwork/lnd/healthcheck v1.2.4 // indirect - github.com/lightningnetwork/lnd/kvdb v1.4.8 // indirect + github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb // indirect + github.com/lightningnetwork/lnd/healthcheck v1.2.5 // indirect + github.com/lightningnetwork/lnd/kvdb v1.4.10 // indirect github.com/lightningnetwork/lnd/queue v1.1.1 // indirect - github.com/lightningnetwork/lnd/sqldb v1.0.2 // indirect + github.com/lightningnetwork/lnd/sqldb v1.0.4 // 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 @@ -141,7 +140,7 @@ require ( github.com/ncruces/go-strftime v0.1.9 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect - github.com/opencontainers/runc v1.1.12 // indirect + github.com/opencontainers/runc v1.1.14 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect @@ -172,13 +171,13 @@ require ( go.etcd.io/etcd/pkg/v3 v3.5.12 // indirect go.etcd.io/etcd/raft/v3 v3.5.12 // indirect go.etcd.io/etcd/server/v3 v3.5.12 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/sdk v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/sdk v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.6.0 // indirect @@ -208,3 +207,8 @@ require ( // We want to format raw bytes as hex instead of base64. The forked version // allows us to specify that as an option. replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display + +// We need this replace until the final custom channel PR (part5) is merged and +// the lnd-18-4 branch of `lndclient` points to that. Otherwise go mod tidy will +// revert the version to what `lndclient` has in its go.mod file. +replace github.com/lightningnetwork/lnd => github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240919094616-a1e9232a52ac diff --git a/go.sum b/go.sum index 7fae92d46..7a80e0228 100644 --- a/go.sum +++ b/go.sum @@ -73,8 +73,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= -github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240403021926-ae5533602c46 h1:tjpNTdZNQqE14menwDGAxWfzN0DFHVTXFEyEL8yvA/4= -github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240403021926-ae5533602c46/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= +github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240625142744-cc26860b4026 h1:s8/96vQSj05bqLl9RyM/eMX8gLtiayEj520TVE4YGy0= +github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240625142744-cc26860b4026/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= @@ -92,8 +92,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtyd github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcwallet v0.16.10-0.20240410030101-6fe19a472a62 h1:MtcTVTcDbGdTJhfDc7LLikojyl0PYtSRNLwoRaLVbWI= -github.com/btcsuite/btcwallet v0.16.10-0.20240410030101-6fe19a472a62/go.mod h1:2C3Q/MhYAKmk7F+Tey6LfKtKRTdQsrCf8AAAzzDPmH4= +github.com/btcsuite/btcwallet v0.16.10-0.20240809133323-7d3434c65ae2 h1:qa4Avm7p97JroZZyMJADbEb9u853pjleJYSeitENvLc= +github.com/btcsuite/btcwallet v0.16.10-0.20240809133323-7d3434c65ae2/go.mod h1:X2xDre+j1QphTRo54y2TikUzeSvreL1t1aMXrD8Kc5A= github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4 h1:poyHFf7+5+RdxNp5r2T6IBRD7RyraUsYARYbp/7t4D8= github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4/go.mod h1:GETGDQuyq+VFfH1S/+/7slLM/9aNa4l7P4ejX6dJfb0= github.com/btcsuite/btcwallet/wallet/txrules v1.2.1 h1:UZo7YRzdHbwhK7Rhv3PO9bXgTxiOH45edK5qdsdiatk= @@ -172,8 +172,8 @@ github.com/docker/cli v20.10.17+incompatible h1:eO2KS7ZFeov5UJeaDmIs1NFEDRf32Paq github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= -github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.9+incompatible h1:HPGzNmwfLZWdxHqK9/II92pyi1EpYKsAqcl4G0Of9v0= +github.com/docker/docker v24.0.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -394,6 +394,8 @@ github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQ 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.3.1 h1:Fcr8QJ1ZeLi5zsPZqQeUZhNhxfkkKBOgJuYkJHoBOtU= +github.com/jackc/pgx/v5 v5.3.1/go.mod h1:t3JDKnCBlYIc0ewLF0Q7B8MXmoIaBOZj/ic7iHozM/8= 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= @@ -409,8 +411,9 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/jrick/logrotate v1.1.2 h1:6ePk462NCX7TfKtNp5JJ7MbA2YIslkpfgP03TlTYMN0= +github.com/jrick/logrotate v1.1.2/go.mod h1:f9tdWggSVK3iqavGpyvegq5IhNois7KXmasU6/N96OQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -446,8 +449,8 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/kkdai/bstream v1.0.0 h1:Se5gHwgp2VT2uHfDrkbbgbgEvV9cimLELwrPJctSjg8= github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+NVZZA= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c= -github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -472,40 +475,40 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libdns/libdns v0.2.1 h1:Wu59T7wSHRgtA0cfxC+n1c/e+O3upJGWytknkmFEDis= github.com/libdns/libdns v0.2.1/go.mod h1:yQCXzk1lEZmmCPa857bnk4TsOiqYasqpyOEeSObbb40= -github.com/lightninglabs/aperture v0.1.21-beta.0.20230705004936-87bb996a4030 h1:q/BBO2awQdy/dCILXXZbBsstQ+1DpSQ/c8B8EgKqg+g= -github.com/lightninglabs/aperture v0.1.21-beta.0.20230705004936-87bb996a4030/go.mod h1:Jvoen+fgoaGQZIHdchiGigu0Lwuwz8S5u5wad9IhVDU= +github.com/lightninglabs/aperture v0.3.2-beta.0.20240919071136-db27bb9a78bd h1:9Q8PU+wdGP3Y0rgi/IZuLAGqgiWuAt7bzm2BqRu6bKg= +github.com/lightninglabs/aperture v0.3.2-beta.0.20240919071136-db27bb9a78bd/go.mod h1:E/14nqcI7wm0mvayuHu1GaUjb6uzs4lSVwh3/ZRCELQ= github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf h1:HZKvJUHlcXI/f/O0Avg7t8sqkPo78HFzjmeYFl6DPnc= github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQPeIQxPf6Jf9rM8R+B4rKBqLA2AjttNxkFBL2Plk= github.com/lightninglabs/lightning-node-connect v0.2.5-alpha h1:ZRVChwczFXK0CEbxOCWwUA6TIZvrkE0APd1T3WjFAwg= github.com/lightninglabs/lightning-node-connect v0.2.5-alpha/go.mod h1:A9Pof9fETkH+F67BnOmrBDThPKstqp73wlImWOZvTXQ= github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2 h1:Er1miPZD2XZwcfE4xoS5AILqP1mj7kqnhbBSxW9BDxY= github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2/go.mod h1:antQGRDRJiuyQF6l+k6NECCSImgCpwaZapATth2Chv4= -github.com/lightninglabs/lndclient v1.0.1-0.20240725080034-64a756aa4c36 h1:gfJ3TOuqSnuXEo1Boj1H9P6tpxPSH9cvi+rB10L0svI= -github.com/lightninglabs/lndclient v1.0.1-0.20240725080034-64a756aa4c36/go.mod h1:bxd2a15cIaW8KKcmOf9nNDI/GTxxj0upEYs1EIkttqw= +github.com/lightninglabs/lndclient v1.0.1-0.20240919113647-5bc7b3fa5a7d h1:Xq10WRGjmzDJyI6lXotvqUZD87DOdcQAcksJbjD4mnE= +github.com/lightninglabs/lndclient v1.0.1-0.20240919113647-5bc7b3fa5a7d/go.mod h1:WGJkH/qCE2pvkCW+P5Hvw4D48E7Ay4fUQ+QV3ZtMO7Q= github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd h1:D8aRocHpoCv43hL8egXEMYyPmyOiefFHZ66338KQB2s= github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd/go.mod h1:x3OmY2wsA18+Kc3TSV2QpSUewOCiscw2mKpXgZv2kZk= github.com/lightninglabs/neutrino/cache v1.1.2 h1:C9DY/DAPaPxbFC+xNNEI/z1SJY9GS3shmlu5hIQ798g= github.com/lightninglabs/neutrino/cache v1.1.2/go.mod h1:XJNcgdOw1LQnanGjw8Vj44CvguYA25IMKjWFZczwZuo= github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display h1:pRdza2wleRN1L2fJXd6ZoQ9ZegVFTAb2bOQfruJPKcY= github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f h1:Pua7+5TcFEJXIIZ1I2YAUapmbcttmLj4TTi786bIi3s= -github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI= -github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240723043204-f09d4042aee4 h1:LPnz0JxnzXJvCro714eBanzO7FKx5HF0ldU++zIu9yY= -github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240723043204-f09d4042aee4/go.mod h1:0gen58n0DVnqJJqCMN3AXNtqWRT0KltQanlvehnhCq0= +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.18.0-beta.rc4.0.20240919094616-a1e9232a52ac h1:i0wxtf101lqcm6/6umrD6IjYSBa7qkU5rr7d9strz0w= +github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240919094616-a1e9232a52ac/go.mod h1:Y4sP4cQS+V8IpDn6hD6zEyX3dkIwUqLkCPtHfXNaVY0= 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= github.com/lightningnetwork/lnd/clock v1.1.1/go.mod h1:mGnAhPyjYZQJmebS7aevElXKTFDuO+uNFFfMXK1W8xQ= -github.com/lightningnetwork/lnd/fn v1.1.0 h1:W1p/bUXMgAh5YlmawdQYaNgmLaLMT77BilepzWOSZ2A= -github.com/lightningnetwork/lnd/fn v1.1.0/go.mod h1:P027+0CyELd92H9gnReUkGGAqbFA1HwjHWdfaDFD51U= -github.com/lightningnetwork/lnd/healthcheck v1.2.4 h1:lLPLac+p/TllByxGSlkCwkJlkddqMP5UCoawCj3mgFQ= -github.com/lightningnetwork/lnd/healthcheck v1.2.4/go.mod h1:G7Tst2tVvWo7cx6mSBEToQC5L1XOGxzZTPB29g9Rv2I= -github.com/lightningnetwork/lnd/kvdb v1.4.8 h1:xH0a5Vi1yrcZ5BEeF2ba3vlKBRxrL9uYXlWTjOjbNTY= -github.com/lightningnetwork/lnd/kvdb v1.4.8/go.mod h1:J2diNABOoII9UrMnxXS5w7vZwP7CA1CStrl8MnIrb3A= +github.com/lightningnetwork/lnd/fn v1.2.1 h1:pPsVGrwi9QBwdLJzaEGK33wmiVKOxs/zc8H7+MamFf0= +github.com/lightningnetwork/lnd/fn v1.2.1/go.mod h1:SyFohpVrARPKH3XVAJZlXdVe+IwMYc4OMAvrDY32kw0= +github.com/lightningnetwork/lnd/healthcheck v1.2.5 h1:aTJy5xeBpcWgRtW/PGBDe+LMQEmNm/HQewlQx2jt7OA= +github.com/lightningnetwork/lnd/healthcheck v1.2.5/go.mod h1:G7Tst2tVvWo7cx6mSBEToQC5L1XOGxzZTPB29g9Rv2I= +github.com/lightningnetwork/lnd/kvdb v1.4.10 h1:vK89IVv1oVH9ubQWU+EmoCQFeVRaC8kfmOrqHbY5zoY= +github.com/lightningnetwork/lnd/kvdb v1.4.10/go.mod h1:J2diNABOoII9UrMnxXS5w7vZwP7CA1CStrl8MnIrb3A= 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.2 h1:PfuYzScYMD9/QonKo/QvgsbXfTnH5DfldIimkfdW4Bk= -github.com/lightningnetwork/lnd/sqldb v1.0.2/go.mod h1:V2Xl6JNWLTKE97WJnwfs0d0TYJdIQTqK8/3aAwkd3qI= +github.com/lightningnetwork/lnd/sqldb v1.0.4 h1:9cMwPxcrLQG8UmyZO4q8SpR7NmxSwBMbj3AispdcwHg= +github.com/lightningnetwork/lnd/sqldb v1.0.4/go.mod h1:4cQOkdymlZ1znnjuRNvMoatQGJkRneTj2CoPSPaQhWo= 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.2.6 h1:icvQG2yDr6k3ZuZzfRdG3EJp6pHurcuh3R6dg0gv/Mw= @@ -570,8 +573,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= +github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w= +github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= @@ -612,8 +615,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qq github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= @@ -701,20 +704,20 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM= -go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= @@ -839,8 +842,8 @@ golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220630215102-69896b714898/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= 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= @@ -863,8 +866,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 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= diff --git a/itest/addrs_test.go b/itest/addrs_test.go index c5b2853e4..d951bf2f4 100644 --- a/itest/addrs_test.go +++ b/itest/addrs_test.go @@ -34,7 +34,7 @@ func testAddresses(t *harnessTest) { // for multiple internal asset transfers when only sending one of them // to an external address. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], issuableAssets[0], }, @@ -79,7 +79,7 @@ func testAddresses(t *harnessTest) { AssertAddrEvent(t.t, secondTapd, addr, 1, statusDetected) // Mine a block to make sure the events are marked as confirmed. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Eventually the event should be marked as confirmed. AssertAddrEvent(t.t, secondTapd, addr, 1, statusConfirmed) @@ -219,7 +219,7 @@ func testAddresses(t *harnessTest) { require.NoError(t.t, err) // Confirm the transfer. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) AssertAddrEvent(t.t, secondTapd, oldAddr, 1, statusConfirmed) AssertNonInteractiveRecvComplete(t.t, secondTapd, 3) @@ -239,7 +239,7 @@ func testAddresses(t *harnessTest) { }) require.NoError(t.t, err) - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) AssertAddrEvent(t.t, secondTapd, newAddr, 1, statusConfirmed) AssertNonInteractiveRecvComplete(t.t, secondTapd, 4) } @@ -249,7 +249,7 @@ func testAddresses(t *harnessTest) { func testMultiAddress(t *harnessTest) { // First, mint an asset, so we have one to create addresses for. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], issuableAssets[0], }, @@ -325,7 +325,7 @@ func testAddressAssetSyncer(t *harnessTest) { ctxt, cancel := context.WithTimeout(ctxb, defaultWaitTimeout) defer cancel() - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // Now that Bob is active, we'll mint some assets with the main node. rpcAssets := MintAssetsConfirmBatch( @@ -605,7 +605,7 @@ func runMultiSendTest(ctxt context.Context, t *harnessTest, alice, AssertAddrEvent(t.t, alice, aliceAddr2, 1, statusDetected) // Mine a block to make sure the events are marked as confirmed. - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Eventually the events should be marked as confirmed. AssertAddrEventByStatus(t.t, bob, statusConfirmed, 2) @@ -669,7 +669,7 @@ func runMultiSendTest(ctxt context.Context, t *harnessTest, alice, func testUnknownTlvType(t *harnessTest) { // First, mint an asset, so we have one to create addresses for. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], issuableAssets[0], }, @@ -717,7 +717,7 @@ func testUnknownTlvType(t *harnessTest) { AssertAddrEvent(t.t, bob, bobAddr, 1, statusDetected) // Mine a block to make sure the events are marked as confirmed. - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Eventually the event should be marked as confirmed. AssertAddrEventByStatus(t.t, bob, statusConfirmed, 1) diff --git a/itest/asset_meta_test.go b/itest/asset_meta_test.go index 71c93ab39..7adce1268 100644 --- a/itest/asset_meta_test.go +++ b/itest/asset_meta_test.go @@ -128,7 +128,7 @@ func testMintAssetWithDecimalDisplayMetaField(t *harnessTest) { firstAssetReq := &mintrpc.MintAssetRequest{Asset: firstAsset} rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{firstAssetReq}, ) require.Len(t.t, rpcSimpleAssets, 1) @@ -187,7 +187,7 @@ func testMintAssetWithDecimalDisplayMetaField(t *harnessTest) { Type: taprpc.AssetMetaType_META_TYPE_JSON, } MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{secondAssetReq}, ) diff --git a/itest/assets_test.go b/itest/assets_test.go index d4648c9f8..0a82eba22 100644 --- a/itest/assets_test.go +++ b/itest/assets_test.go @@ -100,10 +100,10 @@ func testMintAssets(t *harnessTest) { defer cancel() rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, simpleAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, simpleAssets, ) rpcIssuableAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, issuableAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, issuableAssets, ) // Now that all our assets have been issued, we'll use the balance @@ -172,14 +172,14 @@ func testMintBatchResume(t *harnessTest) { require.NoError(t.t, t.tapd.start(false)) hashes, err := waitForNTxsInMempool( - t.lndHarness.Miner.Client, 1, defaultWaitTimeout, + t.lndHarness.Miner().Client, 1, defaultWaitTimeout, ) require.NoError(t.t, err) mintTXID := *hashes[0] // Mine a block to confirm the assets. - block := MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1)[0] + block := MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1)[0] blockHash := block.BlockHash() WaitForBatchState( t.t, ctxt, t.tapd, defaultWaitTimeout, batchKey, @@ -284,7 +284,7 @@ func testMintAssetNameCollisionError(t *harnessTest) { }, } rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{&assetMint}, ) @@ -397,7 +397,7 @@ func testMintAssetNameCollisionError(t *harnessTest) { // Minting the asset with the name collision should work, even though // it is also part of a cancelled batch. rpcCollideAsset := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{&assetCollide}, ) @@ -435,11 +435,11 @@ func testMintAssetsWithTapscriptSibling(t *harnessTest) { } rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, simpleAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, simpleAssets, WithSiblingBranch(siblingReq), ) rpcIssuableAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, issuableAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, issuableAssets, ) AssertAssetBalances(t.t, t.tapd, rpcSimpleAssets, rpcIssuableAssets) @@ -525,7 +525,7 @@ func testMintAssetsWithTapscriptSibling(t *harnessTest) { // Bob should detect the TX, and the resulting confirmed UTXO once // a new block is mined. - t.lndHarness.Miner.AssertNumTxsInMempool(1) + t.lndHarness.Miner().AssertNumTxsInMempool(1) t.lndHarness.AssertNumUTXOsUnconfirmed(t.lndHarness.Bob, 1) t.lndHarness.MineBlocksAndAssertNumTxes(1, 1) t.lndHarness.AssertNumUTXOsWithConf(t.lndHarness.Bob, 1, 1, 1) @@ -537,7 +537,7 @@ func testMintAssetsWithTapscriptSibling(t *harnessTest) { func testMintBatchAndTransfer(t *harnessTest) { ctxb := context.Background() rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, simpleAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, simpleAssets, ) // List the batch right after minting. @@ -578,7 +578,7 @@ func testMintBatchAndTransfer(t *harnessTest) { AssertAddrEvent(t.t, secondTapd, addr, 1, statusDetected) // Mine a block to make sure the events are marked as confirmed. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Eventually the event should be marked as confirmed. AssertAddrEvent(t.t, secondTapd, addr, 1, statusConfirmed) diff --git a/itest/burn_test.go b/itest/burn_test.go index e301af9f9..9a4f61b1e 100644 --- a/itest/burn_test.go +++ b/itest/burn_test.go @@ -18,7 +18,7 @@ import ( // testBurnAssets tests that we're able to mint assets and then burn assets // again. func testBurnAssets(t *harnessTest) { - minerClient := t.lndHarness.Miner.Client + minerClient := t.lndHarness.Miner().Client rpcAssets := MintAssetsConfirmBatch( t.t, minerClient, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], simpleAssets[1], issuableAssets[0], @@ -312,7 +312,7 @@ func testBurnAssets(t *harnessTest) { func testBurnGroupedAssets(t *harnessTest) { var ( ctxb = context.Background() - miner = t.lndHarness.Miner.Client + miner = t.lndHarness.Miner().Client firstMintReq = issuableAssets[0] ) diff --git a/itest/collectible_split_test.go b/itest/collectible_split_test.go index 3a8826829..dce48b172 100644 --- a/itest/collectible_split_test.go +++ b/itest/collectible_split_test.go @@ -27,7 +27,7 @@ import ( func testCollectibleSend(t *harnessTest) { // First, we'll make a collectible with emission enabled. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ issuableAssets[1], // Our "passive" asset. @@ -86,7 +86,7 @@ func testCollectibleSend(t *harnessTest) { t, t.tapd, receiverAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{0, fullAmount}, senderTransferIdx, senderTransferIdx+1, @@ -115,7 +115,7 @@ func testCollectibleSend(t *harnessTest) { t, secondTapd, receiverAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, secondTapd, + t.t, t.lndHarness.Miner().Client, secondTapd, sendResp, genInfo.AssetId, []uint64{0, fullAmount}, receiverTransferIdx, receiverTransferIdx+1, @@ -196,7 +196,7 @@ func testCollectibleSend(t *harnessTest) { AssertAddrCreated(t.t, secondTapd, rpcAssets[1], bobAddr) sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, bobAddr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, passiveGen.AssetId, []uint64{0, rpcAssets[1].Amount}, 2, 3, ) @@ -269,7 +269,7 @@ func testCollectibleGroupSend(t *harnessTest) { batchSize) mintBatch := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, batchReqs, + t.t, t.lndHarness.Miner().Client, t.tapd, batchReqs, WithMintingTimeout(minterTimeout), ) @@ -379,7 +379,7 @@ func testCollectibleGroupSend(t *harnessTest) { sendAssets( t.t, ctxt, numAssets, sendType, send, receive, - t.lndHarness.Miner.Client, + t.lndHarness.Miner().Client, ) t.Logf("Finished %d of %d send operations", i, numSends) diff --git a/itest/fee_estimation_test.go b/itest/fee_estimation_test.go index 73e530d71..647a1ee7c 100644 --- a/itest/fee_estimation_test.go +++ b/itest/fee_estimation_test.go @@ -64,7 +64,7 @@ func testFeeEstimation(t *harnessTest) { // Mint some assets with a NP2WPKH input, which will give us an anchor // output to spend for a transfer. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, simpleAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, simpleAssets, ) // Check the final fee rate of the mint TX. @@ -76,7 +76,7 @@ func testFeeEstimation(t *harnessTest) { // not adjust the fee rate of the TX after it was funded by our backing // wallet. AssertFeeRate( - t.t, t.lndHarness.Miner.Client, anchorAmounts[0], + t.t, t.lndHarness.Miner().Client, anchorAmounts[0], &mintOutpoint.Hash, defaultFeeRate, ) @@ -95,7 +95,7 @@ func testFeeEstimation(t *harnessTest) { transferIdx := 0 ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, normalAssetId, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, normalAssetId, []uint64{splitAmount, splitAmount}, transferIdx, transferIdx+1, ) transferIdx += 1 @@ -105,7 +105,7 @@ func testFeeEstimation(t *harnessTest) { sendInputAmt := anchorAmounts[1] + 1000 AssertTransferFeeRate( - t.t, t.lndHarness.Miner.Client, sendResp, sendInputAmt, + t.t, t.lndHarness.Miner().Client, sendResp, sendInputAmt, defaultFeeRate, ) @@ -124,7 +124,7 @@ func testFeeEstimation(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, t.tapd, addr2) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, normalAssetId, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, normalAssetId, []uint64{secondSplitAmount, secondSplitAmount}, transferIdx, transferIdx+1, ) @@ -135,7 +135,7 @@ func testFeeEstimation(t *harnessTest) { sendInputAmt = anchorAmounts[2] + 1000 AssertTransferFeeRate( - t.t, t.lndHarness.Miner.Client, sendResp, sendInputAmt, + t.t, t.lndHarness.Miner().Client, sendResp, sendInputAmt, higherFeeRate, ) @@ -179,7 +179,7 @@ func testFeeEstimation(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, t.tapd, addr3) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, normalAssetId, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, normalAssetId, []uint64{thirdSplitAmount, thirdSplitAmount}, transferIdx, transferIdx+1, ) @@ -190,7 +190,7 @@ func testFeeEstimation(t *harnessTest) { sendInputAmt = initialUTXOs[3].Amount + 1000 AssertTransferFeeRate( - t.t, t.lndHarness.Miner.Client, sendResp, sendInputAmt, + t.t, t.lndHarness.Miner().Client, sendResp, sendInputAmt, lowFeeRate, ) } diff --git a/itest/full_value_split_test.go b/itest/full_value_split_test.go index 1050b1feb..cb2ec23ba 100644 --- a/itest/full_value_split_test.go +++ b/itest/full_value_split_test.go @@ -14,7 +14,7 @@ func testFullValueSend(t *harnessTest) { // First, we'll make an normal assets with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], issuableAssets[0], }, @@ -81,7 +81,7 @@ func runFullValueSendTests(ctxt context.Context, t *harnessTest, alice, t, alice, receiverAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, alice, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, []uint64{0, fullAmount}, senderTransferIdx, senderTransferIdx+1, @@ -107,7 +107,7 @@ func runFullValueSendTests(ctxt context.Context, t *harnessTest, alice, t, bob, receiverAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bob, sendResp, + t.t, t.lndHarness.Miner().Client, bob, sendResp, genInfo.AssetId, []uint64{0, fullAmount}, receiverTransferIdx, receiverTransferIdx+1, ) diff --git a/itest/mint_batch_stress_test.go b/itest/mint_batch_stress_test.go index 6846f5636..2072fe4e1 100644 --- a/itest/mint_batch_stress_test.go +++ b/itest/mint_batch_stress_test.go @@ -65,7 +65,7 @@ func testMintBatchNStressTest(t *harnessTest, batchSize int, mintBatches := func(reqs []*mintrpc.MintAssetRequest) []*taprpc.Asset { return MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, reqs, + t.t, t.lndHarness.Miner().Client, t.tapd, reqs, WithMintingTimeout(timeout), ) } diff --git a/itest/mint_fund_seal_test.go b/itest/mint_fund_seal_test.go index 3ed7895d8..34d74c573 100644 --- a/itest/mint_fund_seal_test.go +++ b/itest/mint_fund_seal_test.go @@ -311,10 +311,10 @@ func testMintFundSealAssets(t *harnessTest) { } batchTXID, batchKey := FinalizeBatchUnconfirmed( - t.t, t.lndHarness.Miner.Client, aliceTapd, assetReqs, + t.t, t.lndHarness.Miner().Client, aliceTapd, assetReqs, ) batchAssets := ConfirmBatch( - t.t, t.lndHarness.Miner.Client, aliceTapd, assetReqs, sub, + t.t, t.lndHarness.Miner().Client, aliceTapd, assetReqs, sub, batchTXID, batchKey, ) assetTweakedScriptKey, err := fn.First( @@ -472,7 +472,7 @@ func testMintFundSealAssets(t *harnessTest) { transferAmount := assetTweakedScriptKey.Amount / 2 numOutputs := 2 ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, aliceTapd, logResp, + t.t, t.lndHarness.Miner().Client, aliceTapd, logResp, assetTweakedScriptKey.AssetGenesis.AssetId, []uint64{transferAmount, transferAmount}, 0, 1, numOutputs, ) diff --git a/itest/multi_asset_group_test.go b/itest/multi_asset_group_test.go index 983d7c48f..ee5a701b8 100644 --- a/itest/multi_asset_group_test.go +++ b/itest/multi_asset_group_test.go @@ -40,7 +40,7 @@ func testMintMultiAssetGroups(t *harnessTest) { // now be aware of 3 asset groups. Each group should have a different // number of assets, and a different total balance. mintedBatch := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, complexBatch, + t.t, t.lndHarness.Miner().Client, t.tapd, complexBatch, ) // Once the batch is minted, we can verify that all asset groups were @@ -123,7 +123,7 @@ func testMintMultiAssetGroups(t *harnessTest) { t, t.tapd, bobNormalAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, normalGroupSend, + t.t, t.lndHarness.Miner().Client, t.tapd, normalGroupSend, normalMember.AssetGenesis.AssetId, []uint64{0, normalMember.Amount}, 0, 1, ) @@ -163,7 +163,7 @@ func testMintMultiAssetGroups(t *harnessTest) { t, t.tapd, bobCollectAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, collectGroupSend, + t.t, t.lndHarness.Miner().Client, t.tapd, collectGroupSend, collectMember.AssetGenesis.AssetId, []uint64{0, collectMember.Amount}, 1, 2, ) @@ -260,7 +260,7 @@ func testMintMultiAssetGroupErrors(t *harnessTest) { // The assets should be minted into the same group. rpcGroupedAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, multiAssetGroup, + t.t, t.lndHarness.Miner().Client, t.tapd, multiAssetGroup, ) AssertNumGroups(t.t, t.tapd, 1) groupKey := rpcGroupedAssets[0].AssetGroup.TweakedGroupKey @@ -291,7 +291,7 @@ func testMultiAssetGroupSend(t *harnessTest) { // The minted batch should contain 51 assets total, and the daemon // should now be aware of one asset group. mintedBatch := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, collectibleGroup, + t.t, t.lndHarness.Miner().Client, t.tapd, collectibleGroup, ) require.Len(t.t, mintedBatch, collectibleGroupMembers+1) @@ -363,7 +363,7 @@ func testMultiAssetGroupSend(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{0, numUnits}, i, i+1, ) diff --git a/itest/multi_send_test.go b/itest/multi_send_test.go index 35607545e..fb7b8a842 100644 --- a/itest/multi_send_test.go +++ b/itest/multi_send_test.go @@ -94,7 +94,7 @@ func testAnchorMultipleVirtualTransactions(t *harnessTest) { // In our first batch we create multiple units of the grouped asset X // and Y as well as a passive asset P. firstBatch := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ { Asset: assetXTranche1Req, @@ -123,7 +123,7 @@ func testAnchorMultipleVirtualTransactions(t *harnessTest) { // In our second batch we create the third tranche of the grouped asset // X and Y as well as a passive asset Q. secondBatch := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ { Asset: assetXTranche3Req, @@ -260,7 +260,7 @@ func testAnchorMultipleVirtualTransactions(t *harnessTest) { t.Logf("Send response: %v", toJSON(t.t, sendResp)) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, aliceTapd, sendResp, + t.t, t.lndHarness.Miner().Client, aliceTapd, sendResp, assetXTranche1ID[:], []uint64{300, 300, 300}, 0, 1, 3, ) @@ -384,7 +384,7 @@ func testAnchorMultipleVirtualTransactions(t *harnessTest) { assetYTranche1.Amount - assetsToSend, assetsToSend, } ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, aliceTapd, + t.t, t.lndHarness.Miner().Client, aliceTapd, sendResp, assetYTranche1.AssetGenesis.AssetId, expectedAmounts, 3, 4, len(expectedAmounts), ) diff --git a/itest/multisig_test.go b/itest/multisig_test.go index a815aaf88..15cbba57c 100644 --- a/itest/multisig_test.go +++ b/itest/multisig_test.go @@ -25,7 +25,7 @@ func testMultiSignature(t *harnessTest) { MultiSigTest( t.t, context.Background(), aliceTapd, bobTapd, - aliceTapd.rpcHost(), t.lndHarness.Miner.Client, aliceLnd.RPC, + aliceTapd.rpcHost(), t.lndHarness.Miner().Client, aliceLnd.RPC, bobLnd.RPC, regtestParams, defaultTimeout, ) } diff --git a/itest/ownership_test.go b/itest/ownership_test.go index c4124145d..d7abdea8b 100644 --- a/itest/ownership_test.go +++ b/itest/ownership_test.go @@ -25,7 +25,7 @@ func testOwnershipVerification(t *harnessTest) { // Mint some assets on alice. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -48,7 +48,7 @@ func testOwnershipVerification(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, bobAddr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{currentUnits - numUnits, numUnits}, 0, 1, ) diff --git a/itest/psbt_test.go b/itest/psbt_test.go index 87ec2ce2e..3b3665a44 100644 --- a/itest/psbt_test.go +++ b/itest/psbt_test.go @@ -42,7 +42,7 @@ func testPsbtScriptHashLockSend(t *harnessTest) { // First, we'll make a normal asset with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -138,7 +138,7 @@ func testPsbtScriptHashLockSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bob, sendResp, + t.t, t.lndHarness.Miner().Client, bob, sendResp, genInfo.AssetId, []uint64{numUnits / 2, numUnits / 2}, 0, 1, ) @@ -161,7 +161,7 @@ func testPsbtScriptCheckSigSend(t *harnessTest) { // First, we'll make a normal asset with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -261,7 +261,7 @@ func testPsbtScriptCheckSigSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bob, sendResp, + t.t, t.lndHarness.Miner().Client, bob, sendResp, genInfo.AssetId, []uint64{numUnits / 2, numUnits / 2}, 0, 1, ) @@ -286,7 +286,7 @@ func testPsbtNormalInteractiveFullValueSend(t *harnessTest) { // going to send backand forth. We're also minting a passive asset that // should remain where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -334,14 +334,14 @@ func testPsbtMultiVersionSend(t *harnessTest) { // First, we'll mint two assets. firstRpcAsset := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], }, ) secondRpcAsset := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[1], }, @@ -492,7 +492,7 @@ func testPsbtMultiVersionSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, sender, send1Resp, + t.t, t.lndHarness.Miner().Client, sender, send1Resp, firstAsset.AssetGenesis.AssetId, []uint64{firstAssetSplitAmt, firstAssetSplitAmt}, 0, 1, 2, @@ -506,7 +506,7 @@ func testPsbtMultiVersionSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, sender, send2Resp, + t.t, t.lndHarness.Miner().Client, sender, send2Resp, secondAsset.AssetGenesis.AssetId, []uint64{secondAsset.Amount}, 1, 2, 1, ) @@ -541,7 +541,7 @@ func testPsbtGroupedInteractiveFullValueSend(t *harnessTest) { // going to send backand forth. We're also minting a passive asset that // should remain where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ issuableAssets[0], // Our "passive" asset. @@ -636,7 +636,7 @@ func runPsbtInteractiveFullValueSendTest(ctxt context.Context, t *harnessTest, numOutputs := 1 amounts := []uint64{fullAmt} ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, sender, + t.t, t.lndHarness.Miner().Client, sender, sendResp, genInfo.AssetId, amounts, i/2, (i/2)+1, numOutputs, ) @@ -692,7 +692,7 @@ func testPsbtNormalInteractiveSplitSend(t *harnessTest) { // going to send backand forth. We're also minting a passive asset that // should remain where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -739,7 +739,7 @@ func testPsbtGroupedInteractiveSplitSend(t *harnessTest) { // going to send backand forth. We're also minting a passive asset that // should remain where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ issuableAssets[0], // Our "passive" asset. @@ -848,7 +848,7 @@ func runPsbtInteractiveSplitSendTest(ctxt context.Context, t *harnessTest, numOutputs := 2 ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, sender, + t.t, t.lndHarness.Miner().Client, sender, sendResp, genInfo.AssetId, []uint64{sendAmt, changeAmt}, i/2, (i/2)+1, numOutputs, @@ -906,7 +906,7 @@ func testPsbtInteractiveTapscriptSibling(t *harnessTest) { // First, we'll make a normal asset with a bunch of units that we are // going to send backand forth. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -973,7 +973,7 @@ func testPsbtInteractiveTapscriptSibling(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, alice, sendResp, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, []uint64{sendAmt, changeAmt}, 0, 1, 2, ) @@ -1018,7 +1018,7 @@ func testPsbtMultiSend(t *harnessTest) { // going to send backand forth. We're also minting a passive asset that // should remain where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -1141,7 +1141,7 @@ func testPsbtMultiSend(t *harnessTest) { // are 4 BTC anchor outputs but 5 asset transfer outputs. numOutputs := 5 ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, sender, sendResp, + t.t, t.lndHarness.Miner().Client, sender, sendResp, genInfo.AssetId, outputAmounts, 0, 1, numOutputs, ) @@ -1209,7 +1209,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { // Mint a single asset. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, primaryTapd, + t.t, t.lndHarness.Miner().Client, primaryTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) rpcAsset := rpcAssets[0] @@ -1248,7 +1248,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, primaryTapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, primaryTapd, sendResp, + t.t, t.lndHarness.Miner().Client, primaryTapd, sendResp, genInfo.AssetId, []uint64{changeAmt, sendAmt}, 0, 1, ) @@ -1276,7 +1276,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, primaryTapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, primaryTapd, sendResp, + t.t, t.lndHarness.Miner().Client, primaryTapd, sendResp, genInfo.AssetId, []uint64{changeAmt, sendAmt}, 1, 2, ) @@ -1303,7 +1303,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, primaryTapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, primaryTapd, sendResp, + t.t, t.lndHarness.Miner().Client, primaryTapd, sendResp, genInfo.AssetId, []uint64{changeAmt, sendAmt}, 2, 3, ) @@ -1389,7 +1389,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { numOutputs = 2 ) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, secondaryTapd, + t.t, t.lndHarness.Miner().Client, secondaryTapd, sendResp, genInfo.AssetId, []uint64{sendAmt, changeAmt}, currentTransferIdx, numTransfers, numOutputs, @@ -1465,7 +1465,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { numTransfers = 2 numOutputs = 1 ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, secondaryTapd, sendResp, + t.t, t.lndHarness.Miner().Client, secondaryTapd, sendResp, genInfo.AssetId, []uint64{sendAmt}, currentTransferIdx, numTransfers, numOutputs, ) @@ -1511,7 +1511,7 @@ func testPsbtSighashNone(t *harnessTest) { // First, we'll make a normal asset with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -1651,7 +1651,7 @@ func testPsbtSighashNone(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bob, sendResp, + t.t, t.lndHarness.Miner().Client, bob, sendResp, genInfo.AssetId, []uint64{(4*numUnits)/5 - 1, (numUnits / 5) + 1}, 0, 1, ) @@ -1685,7 +1685,7 @@ func testPsbtSighashNoneInvalid(t *harnessTest) { // First, we'll make a normal asset with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -1834,7 +1834,7 @@ func testPsbtSighashNoneInvalid(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bob, sendResp, + t.t, t.lndHarness.Miner().Client, bob, sendResp, genInfo.AssetId, []uint64{(4*numUnits)/5 - 1, (numUnits / 5) + 1}, 0, 1, ) @@ -1860,7 +1860,7 @@ func testPsbtSighashNoneInvalid(t *harnessTest) { func testPsbtTrustlessSwap(t *harnessTest) { // First, we'll make a normal asset. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -2177,7 +2177,7 @@ func testPsbtTrustlessSwap(t *harnessTest) { t.Logf("Logged transaction: %v", toJSON(t.t, logResp)) // Mine a block to confirm the transfer. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // We also need to push the proof for this transfer to the universe // server. @@ -2209,7 +2209,7 @@ func testPsbtExternalCommit(t *harnessTest) { // minted on the default tapd instance that is always created in the // integration test (connected to lnd "Alice"). assets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ issuableAssets[0], // Our "passive" asset. @@ -2330,7 +2330,7 @@ func testPsbtExternalCommit(t *harnessTest) { targetAsset.Amount - assetsToSend, assetsToSend, } ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, aliceTapd, + t.t, t.lndHarness.Miner().Client, aliceTapd, sendResp, targetAssetGenesis.AssetId, expectedAmounts, 0, 1, len(expectedAmounts), ) @@ -2350,7 +2350,7 @@ func testPsbtLockTimeSend(t *harnessTest) { // going to send. We're also minting a passive asset that should remain // where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -2390,7 +2390,7 @@ func testPsbtLockTimeSend(t *harnessTest) { ) copy(id[:], genInfo.AssetId) - _, bestBlock := t.lndHarness.Miner.GetBestBlock() + _, bestBlock := t.lndHarness.Miner().GetBestBlock() lockTimeBlocks := uint64(bestBlock + 6) // We need to derive two keys, one for the new script key and one for @@ -2444,7 +2444,7 @@ func testPsbtLockTimeSend(t *harnessTest) { numOutputs = len(amounts) ) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, alice, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, amounts, currentTransferIdx, numTransfers, numOutputs, ) @@ -2461,7 +2461,7 @@ func testPsbtLockTimeSend(t *harnessTest) { // We mine just 4 blocks, two short of being enough for the relative // time lock. - MineBlocks(t.t, t.lndHarness.Miner.Client, 4, 0) + MineBlocks(t.t, t.lndHarness.Miner().Client, 4, 0) // Now if we spend Bob's asset, we should see a lock time in the anchor // transaction. For that, we need to derive two keys for Alice, one for @@ -2504,10 +2504,10 @@ func testPsbtLockTimeSend(t *harnessTest) { }, ) require.ErrorContains(t.t, err, "non final") - t.lndHarness.Miner.AssertNumTxsInMempool(0) + t.lndHarness.Miner().AssertNumTxsInMempool(0) // After mining a single block, the error should go away. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 0) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 0) // Now we'll attempt to complete the transfer normally, which should // succeed. @@ -2521,7 +2521,7 @@ func testPsbtLockTimeSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, bob, + t.t, t.lndHarness.Miner().Client, bob, sendRespSpend, genInfo.AssetId, amounts, currentTransferIdx, numTransfers, numOutputs, ) @@ -2559,7 +2559,7 @@ func testPsbtRelativeLockTimeSend(t *harnessTest) { // going to send. We're also minting a passive asset that should remain // where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -2652,7 +2652,7 @@ func testPsbtRelativeLockTimeSend(t *harnessTest) { numOutputs = len(amounts) ) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, alice, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, amounts, currentTransferIdx, numTransfers, numOutputs, ) @@ -2669,7 +2669,7 @@ func testPsbtRelativeLockTimeSend(t *harnessTest) { // We mine just 4 blocks, two short of being enough for the relative // time lock. - MineBlocks(t.t, t.lndHarness.Miner.Client, 4, 0) + MineBlocks(t.t, t.lndHarness.Miner().Client, 4, 0) // Now if we spend Bob's asset, we should see a lock time in the anchor // transaction. For that, we need to derive two keys for Alice, one for @@ -2712,10 +2712,10 @@ func testPsbtRelativeLockTimeSend(t *harnessTest) { }, ) require.ErrorContains(t.t, err, "non BIP68 final") - t.lndHarness.Miner.AssertNumTxsInMempool(0) + t.lndHarness.Miner().AssertNumTxsInMempool(0) // After mining a single block, the error should go away. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 0) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 0) // Now we'll attempt to complete the transfer normally, which should // succeed. @@ -2729,7 +2729,7 @@ func testPsbtRelativeLockTimeSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, bob, + t.t, t.lndHarness.Miner().Client, bob, sendRespSpend, genInfo.AssetId, amounts, currentTransferIdx, numTransfers, numOutputs, ) @@ -2768,7 +2768,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { // going to send. We're also minting a passive asset that should remain // where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -2861,7 +2861,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { numOutputs = len(amounts) ) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, alice, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, amounts, currentTransferIdx, numTransfers, numOutputs, ) @@ -2878,7 +2878,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { // We mine just 4 blocks, two short of being enough for the relative // time lock. - MineBlocks(t.t, t.lndHarness.Miner.Client, 4, 0) + MineBlocks(t.t, t.lndHarness.Miner().Client, 4, 0) // Now if we spend Bob's asset, we should see a lock time in the anchor // transaction. For that, we need to derive two keys for Alice, one for @@ -2923,7 +2923,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { }, ) require.ErrorContains(t.t, err, "non BIP68 final") - t.lndHarness.Miner.AssertNumTxsInMempool(0) + t.lndHarness.Miner().AssertNumTxsInMempool(0) // We now do something very stupid and dangerous (don't try this at // home) and manually overwrite the lock time in the anchor transaction. @@ -2947,7 +2947,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { }, ) require.NoError(t.t, err) - t.lndHarness.Miner.AssertNumTxsInMempool(1) + t.lndHarness.Miner().AssertNumTxsInMempool(1) ctxc, streamCancel := context.WithCancel(ctxb) aliceScriptKeyBytes := aliceScriptKey.PubKey.SerializeCompressed() @@ -2964,7 +2964,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { LogAndPublish(t.t, bob, btcPacket, vPackets, nil, commitResp) - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) AssertSendEvents( t.t, aliceScriptKeyBytes, sendEvents, @@ -3040,7 +3040,7 @@ func sendToTapscriptAddr(ctx context.Context, t *harnessTest, alice, changeUnits := mintedAsset.Amount - numUnits ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, alice, sendResp, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, []uint64{changeUnits, numUnits}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, bob, 1) @@ -3064,7 +3064,7 @@ func sendAssetAndAssert(ctx context.Context, t *harnessTest, alice, AssertAddrCreated(t.t, bob, mintedAsset, bobAddr) sendResp, sendEvents := sendAssetsToAddr(t, alice, bobAddr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, alice, sendResp, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, []uint64{change, numUnits}, outTransferIdx, numOutTransfers, ) diff --git a/itest/re-issuance_test.go b/itest/re-issuance_test.go index 752b8bc93..0cfbbe915 100644 --- a/itest/re-issuance_test.go +++ b/itest/re-issuance_test.go @@ -14,7 +14,7 @@ import ( // testReIssuance tests that we can properly reissue an asset into group, and // that the daemon handles a group with multiple assets correctly. func testReIssuance(t *harnessTest) { - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // First, we'll mint a collectible and a normal asset, both with // emission enabled. @@ -72,7 +72,7 @@ func testReIssuance(t *harnessTest) { t, t.tapd, collectGroupAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, firstCollectSend, + t.t, t.lndHarness.Miner().Client, t.tapd, firstCollectSend, collectGenInfo.AssetId, []uint64{0, 1}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, secondTapd, 1) @@ -102,7 +102,7 @@ func testReIssuance(t *harnessTest) { t, t.tapd, normalGroupAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, firstNormalSend, + t.t, t.lndHarness.Miner().Client, t.tapd, firstNormalSend, normalGenInfo.AssetId, []uint64{normalGroupMintHalf, normalGroupMintHalf}, 1, 2, ) @@ -184,7 +184,7 @@ func testReIssuance(t *harnessTest) { t, t.tapd, collectReissueAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, secondCollectSend, + t.t, t.lndHarness.Miner().Client, t.tapd, secondCollectSend, collectReissueInfo.AssetId, []uint64{0, 1}, 2, 3, ) AssertNonInteractiveRecvComplete(t.t, secondTapd, 3) @@ -220,7 +220,7 @@ func testReIssuance(t *harnessTest) { t, secondTapd, collectGenAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, secondTapd.ht.lndHarness.Miner.Client, secondTapd, + t.t, secondTapd.ht.lndHarness.Miner().Client, secondTapd, thirdCollectSend, collectGenInfo.AssetId, []uint64{0, 1}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, t.tapd, 1) @@ -250,7 +250,7 @@ func testReIssuanceAmountOverflow(t *harnessTest) { assetIssueReq.Asset.Amount = math.MaxUint64 assets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{assetIssueReq}, ) require.Equal(t.t, 1, len(assets)) @@ -282,7 +282,7 @@ func testReIssuanceAmountOverflow(t *harnessTest) { func testMintWithGroupKeyErrors(t *harnessTest) { // First, mint a collectible with emission enabled to create one group. collectGroupGen := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[1]}, ) require.Equal(t.t, 1, len(collectGroupGen)) @@ -380,7 +380,7 @@ func testMintWithGroupKeyErrors(t *harnessTest) { t, t.tapd, collectGroupAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, collectSend, + t.t, t.lndHarness.Miner().Client, t.tapd, collectSend, collectGenInfo.AssetId, []uint64{0, 1}, 0, 1, ) AssertSendEventsComplete(t.t, collectGroupAddr.ScriptKey, collectEvents) diff --git a/itest/re-org_test.go b/itest/re-org_test.go index 00e421ddc..445fb2f42 100644 --- a/itest/re-org_test.go +++ b/itest/re-org_test.go @@ -9,6 +9,7 @@ import ( "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" unirpc "github.com/lightninglabs/taproot-assets/taprpc/universerpc" "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/miner" "github.com/stretchr/testify/require" ) @@ -19,8 +20,9 @@ func testReOrgMint(t *harnessTest) { mintRequests := []*mintrpc.MintAssetRequest{ issuableAssets[0], issuableAssets[1], } + lndMiner := t.lndHarness.Miner() mintTXID, batchKey := MintAssetUnconfirmed( - t.t, t.lndHarness.Miner.Client, t.tapd, mintRequests, + t.t, lndMiner.Client, t.tapd, mintRequests, ) ctxb := context.Background() @@ -30,10 +32,9 @@ func testReOrgMint(t *harnessTest) { // Before we mine a block to confirm the mint TX, we create a temporary // miner. tempMiner := spawnTempMiner(t.t, t, ctxt) - miner := t.lndHarness.Miner // And now we mine a block to confirm the assets. - initialBlock := MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1)[0] + initialBlock := MineBlocks(t.t, lndMiner.Client, 1, 1)[0] initialBlockHash := initialBlock.BlockHash() WaitForBatchState( t.t, ctxt, t.tapd, defaultWaitTimeout, batchKey, @@ -41,7 +42,7 @@ func testReOrgMint(t *harnessTest) { ) // Make sure the original mint TX was mined in the first block. - miner.AssertTxInBlock(initialBlock, &mintTXID) + lndMiner.AssertTxInBlock(initialBlock, &mintTXID) t.Logf("Mint TX %v mined in block %v", mintTXID, initialBlockHash) assetList := AssertAssetsMinted( @@ -77,8 +78,8 @@ func testReOrgMint(t *harnessTest) { // Cleanup by mining the minting tx again. newBlock := t.lndHarness.MineBlocksAndAssertNumTxes(1, 1)[0] newBlockHash := newBlock.BlockHash() - _, newBlockHeight := t.lndHarness.Miner.GetBestBlock() - t.lndHarness.Miner.AssertTxInBlock(newBlock, &mintTXID) + _, newBlockHeight := lndMiner.GetBestBlock() + lndMiner.AssertTxInBlock(newBlock, &mintTXID) t.Logf("Mint TX %v re-mined in block %v", mintTXID, newBlockHash) // Let's wait until we see that the proof for the first asset was @@ -122,8 +123,9 @@ func testReOrgSend(t *harnessTest) { mintRequests := []*mintrpc.MintAssetRequest{ issuableAssets[0], issuableAssets[1], } + lndMiner := t.lndHarness.Miner() assetList := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, mintRequests, + t.t, lndMiner.Client, t.tapd, mintRequests, ) ctxb := context.Background() @@ -143,7 +145,6 @@ func testReOrgSend(t *harnessTest) { // Before we mine a block to confirm the mint TX, we create a temporary // miner. tempMiner := spawnTempMiner(t.t, t, ctxt) - miner := t.lndHarness.Miner // Now to the second part of the test: We'll send an asset to Bob, and // then re-org the chain again. @@ -158,8 +159,7 @@ func testReOrgSend(t *harnessTest) { AssertAddrCreated(t.t, secondTapd, sendAsset, bobAddr) sendResp, _ := sendAssetsToAddr(t, t.tapd, bobAddr) initialBlock := ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, - sendAssetGen.AssetId, + t.t, lndMiner.Client, t.tapd, sendResp, sendAssetGen.AssetId, []uint64{sendAsset.Amount - sendAmount, sendAmount}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, secondTapd, 1) @@ -168,13 +168,13 @@ func testReOrgSend(t *harnessTest) { // Make sure the original send TX was mined in the first block. sendTXID, err := chainhash.NewHash(sendResp.Transfer.AnchorTxHash) require.NoError(t.t, err) - miner.AssertTxInBlock(initialBlock, sendTXID) + lndMiner.AssertTxInBlock(initialBlock, sendTXID) t.Logf("Send TX %v mined in block %v", sendTXID, initialBlockHash) // We now generate the re-org. That should put the minting TX back into // the mempool. generateReOrg(t.t, t.lndHarness, tempMiner, 3, 2) - t.lndHarness.Miner.AssertNumTxsInMempool(1) + lndMiner.AssertNumTxsInMempool(1) // This should have caused a reorg, and Alice should sync to the longer // chain, where the funding transaction is not confirmed. @@ -202,8 +202,8 @@ func testReOrgSend(t *harnessTest) { // Cleanup by mining the minting tx again. newBlock := t.lndHarness.MineBlocksAndAssertNumTxes(1, 1)[0] newBlockHash := newBlock.BlockHash() - _, newBlockHeight := t.lndHarness.Miner.GetBestBlock() - t.lndHarness.Miner.AssertTxInBlock(newBlock, sendTXID) + _, newBlockHeight := lndMiner.GetBestBlock() + lndMiner.AssertTxInBlock(newBlock, sendTXID) t.Logf("Send TX %v re-mined in block %v", sendTXID, newBlockHash) // Let's wait until we see that the proof for the first asset was @@ -241,14 +241,14 @@ func testReOrgMintAndSend(t *harnessTest) { // Before we do anything, we spawn a miner. This is where the fork in // the chain starts. tempMiner := spawnTempMiner(t.t, t, ctxt) - miner := t.lndHarness.Miner + lndMiner := t.lndHarness.Miner() // Then, we'll mint a few assets and confirm the batch TX. mintRequests := []*mintrpc.MintAssetRequest{ issuableAssets[0], issuableAssets[1], } assetList := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, mintRequests, + t.t, lndMiner.Client, t.tapd, mintRequests, ) // Now that we have the asset created, we'll make a new node that'll @@ -274,8 +274,7 @@ func testReOrgMintAndSend(t *harnessTest) { AssertAddrCreated(t.t, secondTapd, sendAsset, bobAddr) sendResp, _ := sendAssetsToAddr(t, t.tapd, bobAddr) initialBlock := ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, - sendAssetGen.AssetId, + t.t, lndMiner.Client, t.tapd, sendResp, sendAssetGen.AssetId, []uint64{sendAsset.Amount - sendAmount, sendAmount}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, secondTapd, 1) @@ -284,13 +283,13 @@ func testReOrgMintAndSend(t *harnessTest) { // Make sure the original send TX was mined in the first block. sendTXID, err := chainhash.NewHash(sendResp.Transfer.AnchorTxHash) require.NoError(t.t, err) - miner.AssertTxInBlock(initialBlock, sendTXID) + lndMiner.AssertTxInBlock(initialBlock, sendTXID) t.Logf("Send TX %v mined in block %v", sendTXID, initialBlockHash) // We now generate the re-org. That should put the minting and send TX // back into the mempool. generateReOrg(t.t, t.lndHarness, tempMiner, 4, 2) - t.lndHarness.Miner.AssertNumTxsInMempool(2) + lndMiner.AssertNumTxsInMempool(2) // This should have caused a reorg, and Alice should sync to the longer // chain, where the funding transaction is not confirmed. @@ -323,8 +322,8 @@ func testReOrgMintAndSend(t *harnessTest) { // Cleanup by mining the minting tx again. newBlock := t.lndHarness.MineBlocksAndAssertNumTxes(1, 2)[0] newBlockHash := newBlock.BlockHash() - _, newBlockHeight := t.lndHarness.Miner.GetBestBlock() - t.lndHarness.Miner.AssertTxInBlock(newBlock, sendTXID) + _, newBlockHeight := lndMiner.GetBestBlock() + lndMiner.AssertTxInBlock(newBlock, sendTXID) t.Logf("Send TX %v re-mined in block %v", sendTXID, newBlockHash) // We now restart Bob's daemon, expecting it to pick up the re-org. @@ -360,10 +359,10 @@ func testReOrgMintAndSend(t *harnessTest) { // spawnTempMiner creates a temporary miner that uses the same chain backend // and client as the main miner. func spawnTempMiner(t *testing.T, ht *harnessTest, - ctx context.Context) *lntest.HarnessMiner { + ctx context.Context) *miner.HarnessMiner { - tempHarness := lntest.NewMiner(ctx, t) - tempHarness.Client = ht.lndHarness.Miner.Client + tempHarness := miner.NewMiner(ctx, t) + tempHarness.Client = ht.lndHarness.Miner().Client return tempHarness.SpawnTempMiner() } @@ -372,14 +371,14 @@ func spawnTempMiner(t *testing.T, ht *harnessTest, // Depending on when exactly the temporary miner was spawned, the expectedDelta // might differ from the depth, if the "main" miner already has more blocks. func generateReOrg(t *testing.T, lnd *lntest.HarnessTest, - tempMiner *lntest.HarnessMiner, depth uint32, expectedDelta int32) { + tempMiner *miner.HarnessMiner, depth uint32, expectedDelta int32) { // Now we generate a longer chain with the temp miner. tempMiner.MineEmptyBlocks(int(depth)) // Ensure the chain lengths are what we expect, with the temp miner // being 2 blocks ahead. - lnd.Miner.AssertMinerBlockHeightDelta(tempMiner, expectedDelta) + lnd.Miner().AssertMinerBlockHeightDelta(tempMiner, expectedDelta) // Now we disconnect lnd's chain backend from the original miner, and // connect the two miners together. Since the temporary miner knows @@ -388,14 +387,14 @@ func generateReOrg(t *testing.T, lnd *lntest.HarnessTest, // Connecting to the temporary miner should now cause our original // chain to be re-orged out. - lnd.Miner.ConnectMiner(tempMiner) + lnd.Miner().ConnectMiner(tempMiner) // Once again they should be on the same chain. - lnd.Miner.AssertMinerBlockHeightDelta(tempMiner, 0) + lnd.Miner().AssertMinerBlockHeightDelta(tempMiner, 0) // Now we disconnect the two miners, and connect our original miner to // our chain backend once again. - lnd.Miner.DisconnectMiner(tempMiner) + lnd.Miner().DisconnectMiner(tempMiner) lnd.ConnectMiner() } diff --git a/itest/rfq_test.go b/itest/rfq_test.go index d1558acee..c0a43f56d 100644 --- a/itest/rfq_test.go +++ b/itest/rfq_test.go @@ -44,7 +44,7 @@ func testRfqAssetBuyHtlcIntercept(t *harnessTest) { // Mint an asset with Bob's tapd node. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, ts.BobTapd, + t.t, t.lndHarness.Miner().Client, ts.BobTapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) mintedAssetId := rpcAssets[0].AssetGenesis.AssetId @@ -222,7 +222,7 @@ func testRfqAssetSellHtlcIntercept(t *harnessTest) { // Mint an asset with Alice's tapd node. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, ts.AliceTapd, + t.t, t.lndHarness.Miner().Client, ts.AliceTapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) mintedAssetId := rpcAssets[0].AssetGenesis.AssetId @@ -403,7 +403,7 @@ func newLndNode(name string, outputFunds []btcutil.Amount, PkScript: addrScript, Value: int64(amt), } - ht.Miner.SendOutput(output, minerFeeRate) + ht.Miner().SendOutput(output, minerFeeRate) } // Mine any funding transactions. diff --git a/itest/round_trip_send_test.go b/itest/round_trip_send_test.go index 7046c7fc5..69688cf15 100644 --- a/itest/round_trip_send_test.go +++ b/itest/round_trip_send_test.go @@ -30,7 +30,7 @@ func testRoundTripSend(t *harnessTest) { // First, we'll make a normal assets with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -75,7 +75,7 @@ func testRoundTripSend(t *harnessTest) { t.Logf("Got response from sending assets: %v", sendRespJSON) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{bobAmt, bobAmt}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, secondTapd, 1) @@ -95,7 +95,7 @@ func testRoundTripSend(t *harnessTest) { t.Logf("Got response from sending assets: %v", sendRespJSON) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, secondTapd, + t.t, t.lndHarness.Miner().Client, secondTapd, sendResp, genInfo.AssetId, []uint64{aliceAmt, aliceAmt}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, t.tapd, 1) @@ -194,7 +194,7 @@ func testRoundTripSend(t *harnessTest) { // Mine one block which should contain the sweep transaction. block := t.lndHarness.MineBlocksAndAssertNumTxes(1, 1)[0] sweepTxHash := tx.TxHash() - t.lndHarness.Miner.AssertTxInBlock(block, &sweepTxHash) + t.lndHarness.Miner().AssertTxInBlock(block, &sweepTxHash) unspent := t.lndHarness.Alice.RPC.ListUnspent( &walletrpc.ListUnspentRequest{ diff --git a/itest/send_test.go b/itest/send_test.go index efea3746e..b796f3c61 100644 --- a/itest/send_test.go +++ b/itest/send_test.go @@ -74,7 +74,7 @@ func testBasicSendUnidirectional(t *harnessTest) { // First, we'll make a normal assets with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -114,7 +114,7 @@ func testBasicSendUnidirectional(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, bobAddr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{currentUnits, numUnits}, i, i+1, ) @@ -180,7 +180,7 @@ func testRestartReceiverCheckBalance(t *harnessTest) { // First, we'll make a normal assets with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -230,7 +230,7 @@ func testRestartReceiverCheckBalance(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, bobAddr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{currentUnits, numUnits}, 0, 1, ) @@ -332,7 +332,7 @@ func testResumePendingPackageSend(t *harnessTest) { // Mint (and mine) an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -425,7 +425,7 @@ func testBasicSendPassiveAsset(t *harnessTest) { }, } rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, assets, + t.t, t.lndHarness.Miner().Client, t.tapd, assets, ) firstAsset := rpcAssets[0] genInfo := firstAsset.AssetGenesis @@ -476,7 +476,7 @@ func testBasicSendPassiveAsset(t *harnessTest) { // Assert that the outbound transfer was confirmed. expectedAmtAfterSend := assets[0].Asset.Amount - numUnitsSend ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{expectedAmtAfterSend, numUnitsSend}, 0, 1, ) @@ -513,7 +513,7 @@ func testBasicSendPassiveAsset(t *harnessTest) { expectedAmtAfterSend = assets[1].Asset.Amount - numUnitsSend ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo2.AssetId, []uint64{expectedAmtAfterSend, numUnitsSend}, 1, 2, ) @@ -535,7 +535,7 @@ func testBasicSendPassiveAsset(t *harnessTest) { // Assert that the outbound transfer was confirmed. expectedAmtAfterSend = numUnitsSend - numUnitsSend/2 ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, recvTapd, sendResp, + t.t, t.lndHarness.Miner().Client, recvTapd, sendResp, genInfo.AssetId, []uint64{expectedAmtAfterSend, numUnitsSend / 2}, 0, 1, ) @@ -636,7 +636,7 @@ func testReattemptFailedSendHashmailCourier(t *harnessTest) { // Mint an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -660,7 +660,7 @@ func testReattemptFailedSendHashmailCourier(t *harnessTest) { // Send asset and then mine to confirm the associated on-chain tx. sendAssetsToAddr(t, sendTapd, recvAddr) - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) wg.Wait() } @@ -698,7 +698,7 @@ func testReattemptProofTransferOnTapdRestart(t *harnessTest) { // Use the sending node to mint an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -778,7 +778,7 @@ func testReattemptProofTransferOnTapdRestart(t *harnessTest) { // tx. The on-chain tx should be mined successfully, but we expect the // asset proof transfer to be unsuccessful. sendResp, _ := sendAssetsToAddr(t, sendTapd, recvAddr) - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Wait to ensure that the asset transfer attempt has been made. wg.Wait() @@ -877,7 +877,7 @@ func testReattemptFailedSendUniCourier(t *harnessTest) { // Use the sending node to mint an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -946,7 +946,7 @@ func testReattemptFailedSendUniCourier(t *harnessTest) { // Send asset and then mine to confirm the associated on-chain tx. sendAssetsToAddr(t, sendTapd, recvAddr) - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) wg.Wait() } @@ -983,7 +983,7 @@ func testSpendChangeOutputWhenProofTransferFail(t *harnessTest) { // Use the sending node to mint an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -1053,7 +1053,7 @@ func testSpendChangeOutputWhenProofTransferFail(t *harnessTest) { // tx. The on-chain tx should be mined successfully, but we expect the // asset proof transfer to be unsuccessful. sendAssetsToAddr(t, sendTapd, recvAddr) - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // There may be a delay between mining the anchoring transaction and // recognizing its on-chain confirmation. To handle this potential @@ -1115,7 +1115,7 @@ func testSpendChangeOutputWhenProofTransferFail(t *harnessTest) { AssertAddrCreated(t.t, recvTapd, rpcAssets[0], recvAddr) sendAssetsToAddr(t, sendTapd, recvAddr) - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // There may be a delay between mining the anchoring transaction and // recognizing its on-chain confirmation. To handle this potential @@ -1221,7 +1221,7 @@ func testReattemptFailedReceiveUniCourier(t *harnessTest) { // Mint an asset for sending using the sending tapd node. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -1245,7 +1245,7 @@ func testReattemptFailedReceiveUniCourier(t *harnessTest) { // Send asset and then mine to confirm the associated on-chain tx. sendAssetsToAddr(t, sendTapd, recvAddr) - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // At this point, the proof courier service is running. We will // therefore pause to allow the sender to transfer the proof to the @@ -1408,7 +1408,7 @@ func testOfflineReceiverEventuallyReceives(t *harnessTest) { // Mint an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -1432,7 +1432,7 @@ func testOfflineReceiverEventuallyReceives(t *harnessTest) { // Send asset and then mine to confirm the associated on-chain tx. sendAssetsToAddr(t, sendTapd, recvAddr) - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Pause before restarting receiving tapd node so that sender node has // an opportunity to attempt to send the proof multiple times. @@ -1550,7 +1550,7 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) { // Mint a single asset. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) rpcAsset := rpcAssets[0] @@ -1579,7 +1579,7 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{4000, 1000}, 0, 1, ) @@ -1600,7 +1600,7 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, t.tapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{0, 4000}, 1, 2, ) @@ -1624,7 +1624,7 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, bobTapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bobTapd, sendResp, + t.t, t.lndHarness.Miner().Client, bobTapd, sendResp, genInfo.AssetId, []uint64{0, 5000}, 0, 1, ) @@ -1640,7 +1640,7 @@ func testSendMultipleCoins(t *harnessTest) { // First, we'll make a normal assets with enough units to allow us to // send it to different UTXOs rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -1677,7 +1677,7 @@ func testSendMultipleCoins(t *harnessTest) { // transfer to send the coins back to our wallet in 5 pieces now. sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, addrs...) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{ 0, unitsPerPart, unitsPerPart, unitsPerPart, unitsPerPart, unitsPerPart, @@ -1706,7 +1706,7 @@ func testSendMultipleCoins(t *harnessTest) { t, t.tapd, bobAddrs[i], ) AssertAssetOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp.Transfer, genInfo.AssetId, []uint64{0, unitsPerPart}, i+1, i+2, 2, false, @@ -1732,7 +1732,7 @@ func testSendMultipleCoins(t *harnessTest) { // Now we confirm the 5 transfers and make sure they complete as // expected. - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 5) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 5) AssertNonInteractiveRecvComplete(t.t, secondTapd, 5) for idx, events := range addrSendEvents { AssertSendEventsComplete(t.t, bobAddrs[idx].ScriptKey, events) @@ -1747,7 +1747,7 @@ func testSendNoCourierUniverseImport(t *harnessTest) { // First, we'll make a normal assets with enough units. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -1786,7 +1786,7 @@ func testSendNoCourierUniverseImport(t *harnessTest) { // Assert that the outbound transfer was confirmed. expectedAmtAfterSend := firstAsset.Amount - numUnitsSend ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{expectedAmtAfterSend, numUnitsSend}, 0, 1, ) diff --git a/itest/universe_federation_test.go b/itest/universe_federation_test.go index b4325b850..b98e03417 100644 --- a/itest/universe_federation_test.go +++ b/itest/universe_federation_test.go @@ -67,7 +67,7 @@ func testMintProofRepeatFedSyncAttempt(t *harnessTest) { // Now that federation peer node is inactive, we'll mint some assets. t.Logf("Minting assets on minting node") rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, mintingNode, + t.t, t.lndHarness.Miner().Client, mintingNode, []*mintrpc.MintAssetRequest{ simpleAssets[0], issuableAssets[0], }, diff --git a/itest/universe_pagination_test.go b/itest/universe_pagination_test.go index 39f1614c7..046296d56 100644 --- a/itest/universe_pagination_test.go +++ b/itest/universe_pagination_test.go @@ -44,7 +44,7 @@ func testUniversePaginationSimple(t *harnessTest) { mintBatches := func(reqs []*mintrpc.MintAssetRequest) []*taprpc.Asset { return MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, reqs, + t.t, t.lndHarness.Miner().Client, t.tapd, reqs, WithMintingTimeout(timeout), ) } diff --git a/itest/universe_test.go b/itest/universe_test.go index c253432dc..89718df8f 100644 --- a/itest/universe_test.go +++ b/itest/universe_test.go @@ -30,7 +30,7 @@ import ( // testUniverseSync tests that we're able to properly sync the universe state // between two nodes. func testUniverseSync(t *harnessTest) { - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // First, we'll create out usual set of simple and also issuable // assets. rpcSimpleAssets := MintAssetsConfirmBatch( @@ -296,7 +296,7 @@ func testUniverseSync(t *harnessTest) { // testUniverseManualSync tests that we're able to insert proofs manually into // a universe instead of using a full sync. func testUniverseManualSync(t *harnessTest) { - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // First, we'll create out usual set of issuable assets. rpcIssuableAssets := MintAssetsConfirmBatch( @@ -386,7 +386,7 @@ func unmarshalMerkleSumNode(root *unirpc.MerkleSumNode) mssmt.Node { // testUniverseREST tests that we're able to properly query the universe state // via the REST interface. func testUniverseREST(t *harnessTest) { - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // Mint a few assets that we then want to inspect in the universe. rpcSimpleAssets := MintAssetsConfirmBatch( t.t, miner, t.tapd, simpleAssets, @@ -513,7 +513,7 @@ func testUniverseFederation(t *harnessTest) { ctxt, cancel := context.WithTimeout(ctxb, defaultWaitTimeout) defer cancel() - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // Now that Bob is active, we'll make a set of assets with the main node. firstAsset := MintAssetsConfirmBatch(t.t, miner, t.tapd, simpleAssets[:1]) diff --git a/itest/utils.go b/itest/utils.go index b70a0affd..6a2ead3f9 100644 --- a/itest/utils.go +++ b/itest/utils.go @@ -221,7 +221,7 @@ func MakeOutput(t *harnessTest, wallet *node.HarnessNode, func SetNodeUTXOs(t *harnessTest, wallet *node.HarnessNode, feeRate btcutil.Amount, reqs []*UTXORequest) { - minerAddr := t.lndHarness.Miner.NewMinerAddress() + minerAddr := t.lndHarness.Miner().NewMinerAddress() // Drain any funds held by the node. wallet.RPC.SendCoins(&lnrpc.SendCoinsRequest{ @@ -237,7 +237,7 @@ func SetNodeUTXOs(t *harnessTest, wallet *node.HarnessNode, return MakeOutput(t, wallet, r.Type, r.Amount) }) - _ = t.lndHarness.Miner.SendOutputsWithoutChange(aliceOutputs, feeRate) + _ = t.lndHarness.Miner().SendOutputsWithoutChange(aliceOutputs, feeRate) t.lndHarness.MineBlocksAndAssertNumTxes(1, 1) t.lndHarness.WaitForBlockchainSync(wallet) } diff --git a/rfq/order.go b/rfq/order.go index 66fe43afd..76455ddde 100644 --- a/rfq/order.go +++ b/rfq/order.go @@ -230,7 +230,7 @@ func (c *AssetPurchasePolicy) CheckHtlcCompliance( htlc lndclient.InterceptedHtlc) error { // Check that the HTLC contains the accepted quote ID. - htlcRecord, err := parseHtlcCustomRecords(htlc.WireCustomRecords) + htlcRecord, err := parseHtlcCustomRecords(htlc.InWireCustomRecords) if err != nil { return fmt.Errorf("parsing HTLC custom records failed: %w", err) } @@ -288,7 +288,7 @@ func (c *AssetPurchasePolicy) GenerateInterceptorResponse( htlc lndclient.InterceptedHtlc) (*lndclient.InterceptedHtlcResponse, error) { - htlcRecord, err := parseHtlcCustomRecords(htlc.WireCustomRecords) + htlcRecord, err := parseHtlcCustomRecords(htlc.InWireCustomRecords) if err != nil { return nil, fmt.Errorf("parsing HTLC custom records failed: %w", err) @@ -639,10 +639,10 @@ func (h *OrderHandler) fetchPolicy(htlc lndclient.InterceptedHtlc) (Policy, // If the HTLC has a custom record, we check if it is relevant to the // RFQ service. - if len(htlc.WireCustomRecords) > 0 { + if len(htlc.InWireCustomRecords) > 0 { log.Debug("HTLC has custom records, parsing them") htlcRecords, err := parseHtlcCustomRecords( - htlc.WireCustomRecords, + htlc.InWireCustomRecords, ) if err != nil { return nil, false, fmt.Errorf("parsing HTLC custom "+ diff --git a/server.go b/server.go index 616a4d7e5..53cf71ee6 100644 --- a/server.go +++ b/server.go @@ -31,11 +31,12 @@ import ( "github.com/lightningnetwork/lnd/input" "github.com/lightningnetwork/lnd/lncfg" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lnwallet" + "github.com/lightningnetwork/lnd/lntypes" + lnwl "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/chancloser" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/macaroons" - "github.com/lightningnetwork/lnd/protofsm" + "github.com/lightningnetwork/lnd/msgmux" "github.com/lightningnetwork/lnd/routing" "github.com/lightningnetwork/lnd/sweep" "github.com/lightningnetwork/lnd/tlv" @@ -684,15 +685,17 @@ func (s *Server) Stop() error { // A compile-time check to ensure that Server fully implements the // lnwallet.AuxLeafStore, lnd.AuxDataParser, lnwallet.AuxSigner, -// protofsm.MsgEndpoint, funding.AuxFundingController, routing.TlvTrafficShaper +// msgmux.Endpoint, funding.AuxFundingController, routing.TlvTrafficShaper // and chancloser.AuxChanCloser interfaces. -var _ lnwallet.AuxLeafStore = (*Server)(nil) +var _ lnwl.AuxLeafStore = (*Server)(nil) var _ lnd.AuxDataParser = (*Server)(nil) -var _ lnwallet.AuxSigner = (*Server)(nil) -var _ protofsm.MsgEndpoint = (*Server)(nil) +var _ lnwl.AuxSigner = (*Server)(nil) +var _ msgmux.Endpoint = (*Server)(nil) var _ funding.AuxFundingController = (*Server)(nil) var _ routing.TlvTrafficShaper = (*Server)(nil) var _ chancloser.AuxChanCloser = (*Server)(nil) +var _ lnwl.AuxContractResolver = (*Server)(nil) +var _ sweep.AuxSweeper = (*Server)(nil) // waitForReady blocks until the server is ready to serve requests. If the // server is shutting down before we ever become ready, an error is returned. @@ -714,23 +717,18 @@ func (s *Server) waitForReady() error { // the passed aux blob, and pending fully evaluated HTLC view. // // NOTE: This method is part of the lnwallet.AuxLeafStore interface. -func (s *Server) FetchLeavesFromView(chanState *channeldb.OpenChannel, - prevBlob tlv.Blob, view *lnwallet.HtlcView, isOurCommit bool, - ourBalance, theirBalance lnwire.MilliSatoshi, - keys lnwallet.CommitmentKeyRing) (lfn.Option[lnwallet.CommitAuxLeaves], - lnwallet.CommitSortFunc, error) { +func (s *Server) FetchLeavesFromView( + in lnwl.CommitDiffAuxInput) lfn.Result[lnwl.CommitDiffAuxResult] { - srvrLog.Debugf("FetchLeavesFromView called, isOurCommit=%v, "+ + srvrLog.Debugf("FetchLeavesFromView called, whoseCommit=%v, "+ "ourBalance=%v, theirBalance=%v, numOurUpdates=%d, "+ - "numTheirUpdates=%d", isOurCommit, ourBalance, theirBalance, - len(view.OurUpdates), len(view.TheirUpdates)) + "numTheirUpdates=%d", in.WhoseCommit, in.OurBalance, + in.TheirBalance, len(in.UnfilteredView.OurUpdates), + len(in.UnfilteredView.TheirUpdates)) // The aux leaf creator is fully stateless, and we don't need to wait // for the server to be started before being able to use it. - return tapchannel.FetchLeavesFromView( - s.chainParams, chanState, prevBlob, view, isOurCommit, - ourBalance, theirBalance, keys, - ) + return tapchannel.FetchLeavesFromView(s.chainParams, in) } // FetchLeavesFromCommit attempts to fetch the auxiliary leaves that @@ -738,10 +736,10 @@ func (s *Server) FetchLeavesFromView(chanState *channeldb.OpenChannel, // commitment. // // NOTE: This method is part of the lnwallet.AuxLeafStore interface. -func (s *Server) FetchLeavesFromCommit(chanState *channeldb.OpenChannel, +// nolint:lll +func (s *Server) FetchLeavesFromCommit(chanState lnwl.AuxChanState, com channeldb.ChannelCommitment, - keys lnwallet.CommitmentKeyRing) (lfn.Option[lnwallet.CommitAuxLeaves], - error) { + keys lnwl.CommitmentKeyRing) lfn.Result[lnwl.CommitDiffAuxResult] { srvrLog.Debugf("FetchLeavesFromCommit called, ourBalance=%v, "+ "theirBalance=%v, numHtlcs=%d", com.LocalBalance, @@ -759,16 +757,15 @@ func (s *Server) FetchLeavesFromCommit(chanState *channeldb.OpenChannel, // // NOTE: This method is part of the lnwallet.AuxLeafStore interface. func (s *Server) FetchLeavesFromRevocation( - rev *channeldb.RevocationLog) (lfn.Option[lnwallet.CommitAuxLeaves], - error) { + r *channeldb.RevocationLog) lfn.Result[lnwl.CommitDiffAuxResult] { srvrLog.Debugf("FetchLeavesFromRevocation called, ourBalance=%v, "+ - "teirBalance=%v, numHtlcs=%d", rev.OurBalance, rev.TheirBalance, - len(rev.HTLCEntries)) + "teirBalance=%v, numHtlcs=%d", r.OurBalance, r.TheirBalance, + len(r.HTLCEntries)) // The aux leaf creator is fully stateless, and we don't need to wait // for the server to be started before being able to use it. - return tapchannel.FetchLeavesFromRevocation(rev) + return tapchannel.FetchLeavesFromRevocation(r) } // ApplyHtlcView serves as the state transition function for the custom @@ -776,22 +773,18 @@ func (s *Server) FetchLeavesFromRevocation( // blob should be returned that reflects the pending updates. // // NOTE: This method is part of the lnwallet.AuxLeafStore interface. -func (s *Server) ApplyHtlcView(chanState *channeldb.OpenChannel, - prevBlob tlv.Blob, originalView *lnwallet.HtlcView, isOurCommit bool, - ourBalance, theirBalance lnwire.MilliSatoshi, - keys lnwallet.CommitmentKeyRing) (lfn.Option[tlv.Blob], error) { +func (s *Server) ApplyHtlcView( + in lnwl.CommitDiffAuxInput) lfn.Result[lfn.Option[tlv.Blob]] { - srvrLog.Debugf("ApplyHtlcView called, isOurCommit=%v, "+ + srvrLog.Debugf("ApplyHtlcView called, whoseCommit=%v, "+ "ourBalance=%v, theirBalance=%v, numOurUpdates=%d, "+ - "numTheirUpdates=%d", isOurCommit, ourBalance, theirBalance, - len(originalView.OurUpdates), len(originalView.TheirUpdates)) + "numTheirUpdates=%d", in.WhoseCommit, in.OurBalance, + in.TheirBalance, len(in.UnfilteredView.OurUpdates), + len(in.UnfilteredView.TheirUpdates)) // The aux leaf creator is fully stateless, and we don't need to wait // for the server to be started before being able to use it. - return tapchannel.ApplyHtlcView( - s.chainParams, chanState, prevBlob, originalView, isOurCommit, - ourBalance, theirBalance, keys, - ) + return tapchannel.ApplyHtlcView(s.chainParams, in) } // InlineParseCustomData replaces any custom data binary blob in the given RPC @@ -811,15 +804,15 @@ func (s *Server) InlineParseCustomData(msg proto.Message) error { // Name returns the name of this endpoint. This MUST be unique across all // registered endpoints. // -// NOTE: This method is part of the protofsm.MsgEndpoint interface. -func (s *Server) Name() protofsm.EndpointName { +// NOTE: This method is part of the msgmux.MsgEndpoint interface. +func (s *Server) Name() msgmux.EndpointName { return tapchannel.MsgEndpointName } // CanHandle returns true if the target message can be routed to this endpoint. // -// NOTE: This method is part of the protofsm.MsgEndpoint interface. -func (s *Server) CanHandle(msg protofsm.PeerMsg) bool { +// NOTE: This method is part of the msgmux.MsgEndpoint interface. +func (s *Server) CanHandle(msg msgmux.PeerMsg) bool { <-s.ready return s.cfg.AuxFundingController.CanHandle(msg) } @@ -827,8 +820,8 @@ func (s *Server) CanHandle(msg protofsm.PeerMsg) bool { // SendMessage handles the target message, and returns true if the message was // able to be processed. // -// NOTE: This method is part of the protofsm.MsgEndpoint interface. -func (s *Server) SendMessage(msg protofsm.PeerMsg) bool { +// NOTE: This method is part of the msgmux.MsgEndpoint interface. +func (s *Server) SendMessage(msg msgmux.PeerMsg) bool { <-s.ready return s.cfg.AuxFundingController.SendMessage(msg) } @@ -837,8 +830,8 @@ func (s *Server) SendMessage(msg protofsm.PeerMsg) bool { // asynchronously. // // NOTE: This method is part of the lnwallet.AuxSigner interface. -func (s *Server) SubmitSecondLevelSigBatch(chanState *channeldb.OpenChannel, - commitTx *wire.MsgTx, sigJob []lnwallet.AuxSigJob) error { +func (s *Server) SubmitSecondLevelSigBatch(chanState lnwl.AuxChanState, + commitTx *wire.MsgTx, sigJob []lnwl.AuxSigJob) error { srvrLog.Debugf("SubmitSecondLevelSigBatch called, numSigs=%d", len(sigJob)) @@ -857,7 +850,7 @@ func (s *Server) SubmitSecondLevelSigBatch(chanState *channeldb.OpenChannel, // // NOTE: This method is part of the lnwallet.AuxSigner interface. func (s *Server) PackSigs( - blob []lfn.Option[tlv.Blob]) (lfn.Option[tlv.Blob], error) { + blob []lfn.Option[tlv.Blob]) lfn.Result[lfn.Option[tlv.Blob]] { srvrLog.Debugf("PackSigs called") @@ -870,8 +863,8 @@ func (s *Server) PackSigs( // signatures for each HTLC, keyed by HTLC index. // // NOTE: This method is part of the lnwallet.AuxSigner interface. -func (s *Server) UnpackSigs(blob lfn.Option[tlv.Blob]) ([]lfn.Option[tlv.Blob], - error) { +func (s *Server) UnpackSigs( + blob lfn.Option[tlv.Blob]) lfn.Result[[]lfn.Option[tlv.Blob]] { srvrLog.Debugf("UnpackSigs called") @@ -884,8 +877,8 @@ func (s *Server) UnpackSigs(blob lfn.Option[tlv.Blob]) ([]lfn.Option[tlv.Blob], // jobs. // // NOTE: This method is part of the lnwallet.AuxSigner interface. -func (s *Server) VerifySecondLevelSigs(chanState *channeldb.OpenChannel, - commitTx *wire.MsgTx, verifyJob []lnwallet.AuxVerifyJob) error { +func (s *Server) VerifySecondLevelSigs(chanState lnwl.AuxChanState, + commitTx *wire.MsgTx, verifyJob []lnwl.AuxVerifyJob) error { srvrLog.Debugf("VerifySecondLevelSigs called") @@ -902,18 +895,18 @@ func (s *Server) VerifySecondLevelSigs(chanState *channeldb.OpenChannel, // // NOTE: This method is part of the funding.AuxFundingController interface. func (s *Server) DescFromPendingChanID(pid funding.PendingChanID, - chanState *channeldb.OpenChannel, localKeys, - remoteKeys lnwallet.CommitmentKeyRing, - initiator bool) (lfn.Option[lnwallet.AuxFundingDesc], error) { + chanState lnwl.AuxChanState, + keyRing lntypes.Dual[lnwl.CommitmentKeyRing], + initiator bool) funding.AuxFundingDescResult { srvrLog.Debugf("DescFromPendingChanID called") if err := s.waitForReady(); err != nil { - return lfn.None[lnwallet.AuxFundingDesc](), err + return lfn.Err[lfn.Option[lnwl.AuxFundingDesc]](err) } return s.cfg.AuxFundingController.DescFromPendingChanID( - pid, chanState, localKeys, remoteKeys, initiator, + pid, chanState, keyRing, initiator, ) } @@ -923,12 +916,12 @@ func (s *Server) DescFromPendingChanID(pid funding.PendingChanID, // // NOTE: This method is part of the funding.AuxFundingController interface. func (s *Server) DeriveTapscriptRoot( - pid funding.PendingChanID) (lfn.Option[chainhash.Hash], error) { + pid funding.PendingChanID) funding.AuxTapscriptResult { srvrLog.Debugf("DeriveTapscriptRoot called") if err := s.waitForReady(); err != nil { - return lfn.None[chainhash.Hash](), err + return lfn.Err[lfn.Option[chainhash.Hash]](err) } return s.cfg.AuxFundingController.DeriveTapscriptRoot(pid) @@ -938,7 +931,7 @@ func (s *Server) DeriveTapscriptRoot( // be used. This can be used to perform any final setup or cleanup. // // NOTE: This method is part of the funding.AuxFundingController interface. -func (s *Server) ChannelReady(openChan *channeldb.OpenChannel) error { +func (s *Server) ChannelReady(openChan lnwl.AuxChanState) error { srvrLog.Debugf("ChannelReady called") if err := s.waitForReady(); err != nil { @@ -962,14 +955,14 @@ func (s *Server) ChannelFinalized(pid funding.PendingChanID) error { return s.cfg.AuxFundingController.ChannelFinalized(pid) } -// HandleTraffic is called in order to check if the channel identified by the -// provided channel ID is handled by the traffic shaper implementation. If it -// is handled by the traffic shaper, then the normal bandwidth calculation can -// be skipped and the bandwidth returned by PaymentBandwidth should be used +// ShouldHandleTraffic is called in order to check if the channel identified by +// the provided channel ID is handled by the traffic shaper implementation. If +// it is handled by the traffic shaper, then the normal bandwidth calculation +// can be skipped and the bandwidth returned by PaymentBandwidth should be used // instead. // // NOTE: This method is part of the routing.TlvTrafficShaper interface. -func (s *Server) HandleTraffic(cid lnwire.ShortChannelID, +func (s *Server) ShouldHandleTraffic(cid lnwire.ShortChannelID, fundingBlob lfn.Option[tlv.Blob]) (bool, error) { srvrLog.Debugf("HandleTraffic called, cid=%v, fundingBlob=%v", cid, @@ -979,7 +972,7 @@ func (s *Server) HandleTraffic(cid lnwire.ShortChannelID, return false, err } - return s.cfg.AuxTrafficShaper.HandleTraffic(cid, fundingBlob) + return s.cfg.AuxTrafficShaper.ShouldHandleTraffic(cid, fundingBlob) } // PaymentBandwidth returns the available bandwidth for a custom channel decided @@ -1011,8 +1004,8 @@ func (s *Server) PaymentBandwidth(htlcBlob, commitmentBlob lfn.Option[tlv.Blob], // // NOTE: This method is part of the routing.TlvTrafficShaper interface. func (s *Server) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, - htlcCustomRecords lnwire.CustomRecords) (lnwire.MilliSatoshi, tlv.Blob, - error) { + htlcCustomRecords lnwire.CustomRecords) (lnwire.MilliSatoshi, + lnwire.CustomRecords, error) { srvrLog.Debugf("ProduceHtlcExtraData called, totalAmount=%d, "+ "htlcBlob=%v", totalAmount, spew.Sdump(htlcCustomRecords)) @@ -1081,9 +1074,9 @@ func (s *Server) FinalizeClose(desc chancloser.AuxCloseDesc, // ResolveContract attempts to obtain a resolution blob for the specified // contract. -func (s *Server) ResolveContract( - req lnwallet.ResolutionReq) lfn.Result[tlv.Blob] { - +// +// NOTE: This method is part of the lnwallet.AuxContractResolver interface. +func (s *Server) ResolveContract(req lnwl.ResolutionReq) lfn.Result[tlv.Blob] { srvrLog.Tracef("ResolveContract called, req=%v", spew.Sdump(req)) if err := s.waitForReady(); err != nil { @@ -1096,8 +1089,10 @@ func (s *Server) ResolveContract( // DeriveSweepAddr takes a set of inputs, and the change address we'd use to // sweep them, and maybe results in an extra sweep output that we should add to // the sweeping transaction. +// +// NOTE: This method is part of the sweep.AuxSweeper interface. func (s *Server) DeriveSweepAddr(inputs []input.Input, - change lnwallet.AddrWithKey) lfn.Result[sweep.SweepOutput] { + change lnwl.AddrWithKey) lfn.Result[sweep.SweepOutput] { srvrLog.Tracef("DeriveSweepAddr called, inputs=%v, change=%v", spew.Sdump(inputs), spew.Sdump(change)) @@ -1109,8 +1104,27 @@ func (s *Server) DeriveSweepAddr(inputs []input.Input, return s.cfg.AuxSweeper.DeriveSweepAddr(inputs, change) } +// ExtraBudgetForInputs takes a set of inputs and maybe returns an extra budget +// that should be added to the sweep transaction. +// +// NOTE: This method is part of the sweep.AuxSweeper interface. +func (s *Server) ExtraBudgetForInputs( + inputs []input.Input) lfn.Result[btcutil.Amount] { + + srvrLog.Tracef("ExtraBudgetForInputs called, inputs=%v", + spew.Sdump(inputs)) + + if err := s.waitForReady(); err != nil { + return lfn.Err[btcutil.Amount](err) + } + + return s.cfg.AuxSweeper.ExtraBudgetForInputs(inputs) +} + // NotifyBroadcast is used to notify external callers of the broadcast of a // sweep transaction, generated by the passed BumpRequest. +// +// NOTE: This method is part of the sweep.AuxSweeper interface. func (s *Server) NotifyBroadcast(req *sweep.BumpRequest, tx *wire.MsgTx, fee btcutil.Amount) error { diff --git a/tapcfg/config.go b/tapcfg/config.go index bf869d923..73cce0d58 100644 --- a/tapcfg/config.go +++ b/tapcfg/config.go @@ -528,7 +528,7 @@ func LoadConfig(interceptor signal.Interceptor) (*Config, btclog.Logger, error) // Initialize logging at the default logging level. tap.SetupLoggers(cfg.LogWriter, interceptor) err = cfg.LogWriter.InitLogRotator( - filepath.Join(cleanCfg.LogDir, defaultLogFilename), + filepath.Join(cleanCfg.LogDir, defaultLogFilename), build.Gzip, cleanCfg.MaxLogFileSize, cfg.MaxLogFiles, ) if err != nil { diff --git a/tapchannel/auf_leaf_signer_test.go b/tapchannel/auf_leaf_signer_test.go index 3475523e7..f00a19be5 100644 --- a/tapchannel/auf_leaf_signer_test.go +++ b/tapchannel/auf_leaf_signer_test.go @@ -40,7 +40,7 @@ var ( testTimeout = time.Second - chanState = &channeldb.OpenChannel{ + chanState = lnwallet.AuxChanState{ ChanType: channeldb.AnchorOutputsBit | channeldb.ScidAliasChanBit | channeldb.SingleFunderBit | channeldb.SimpleTaprootFeatureBit | @@ -70,7 +70,7 @@ func RandAuxSigJob(t *testing.T, cancelChan chan struct{}, BaseAuxJob: lnwallet.BaseAuxJob{ OutputIndex: outputIdx, KeyRing: keyRing, - HTLC: lnwallet.PaymentDescriptor{ + HTLC: lnwallet.AuxHtlcDescriptor{ HtlcIndex: 0, Amount: lnwire.NewMSatFromSatoshis( 354, diff --git a/tapchannel/aux_funding_controller.go b/tapchannel/aux_funding_controller.go index dc319d805..24fd92f8c 100644 --- a/tapchannel/aux_funding_controller.go +++ b/tapchannel/aux_funding_controller.go @@ -33,14 +33,14 @@ import ( "github.com/lightninglabs/taproot-assets/tappsbt" "github.com/lightninglabs/taproot-assets/tapsend" "github.com/lightninglabs/taproot-assets/vm" - "github.com/lightningnetwork/lnd/channeldb" lfn "github.com/lightningnetwork/lnd/fn" "github.com/lightningnetwork/lnd/funding" "github.com/lightningnetwork/lnd/keychain" + "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/lightningnetwork/lnd/lnwire" - "github.com/lightningnetwork/lnd/protofsm" + "github.com/lightningnetwork/lnd/msgmux" ) const ( @@ -226,11 +226,9 @@ type bindFundingReq struct { pendingChanID funding.PendingChanID - openChan *channeldb.OpenChannel + openChan lnwallet.AuxChanState - localKeyRing lnwallet.CommitmentKeyRing - - remoteKeyRing lnwallet.CommitmentKeyRing + keyRing lntypes.Dual[lnwallet.CommitmentKeyRing] resp chan lfn.Option[lnwallet.AuxFundingDesc] } @@ -252,7 +250,7 @@ type FundingController struct { cfg FundingControllerCfg - msgs chan protofsm.PeerMsg + msgs chan msgmux.PeerMsg bindFundingReqs chan *bindFundingReq @@ -271,7 +269,7 @@ type FundingController struct { func NewFundingController(cfg FundingControllerCfg) *FundingController { return &FundingController{ cfg: cfg, - msgs: make(chan protofsm.PeerMsg, 10), + msgs: make(chan msgmux.PeerMsg, 10), bindFundingReqs: make(chan *bindFundingReq, 10), newFundingReqs: make(chan *FundReq, 10), rootReqs: make(chan *assetRootReq, 10), @@ -395,9 +393,10 @@ func (p *pendingAssetFunding) addToFundingCommitment(a *asset.Asset) error { // newCommitBlobAndLeaves creates a new commitment blob that'll be stored in // the channel state for the specified party. func newCommitBlobAndLeaves(pendingFunding *pendingAssetFunding, - lndOpenChan *channeldb.OpenChannel, assetOpenChan *cmsg.OpenChannel, - keyRing lnwallet.CommitmentKeyRing, - localCommit bool) ([]byte, lnwallet.CommitAuxLeaves, error) { + lndOpenChan lnwallet.AuxChanState, assetOpenChan *cmsg.OpenChannel, + keyRing lntypes.Dual[lnwallet.CommitmentKeyRing], + whoseCommit lntypes.ChannelParty) ([]byte, lnwallet.CommitAuxLeaves, + error) { chanAssets := assetOpenChan.FundedAssets.Val.Outputs @@ -412,16 +411,16 @@ func newCommitBlobAndLeaves(pendingFunding *pendingAssetFunding, // the balances in the previous state are reversed and // generateAllocations will flip them back. switch { - case pendingFunding.initiator && localCommit: + case pendingFunding.initiator && whoseCommit.IsLocal(): localAssets = chanAssets - case pendingFunding.initiator && !localCommit: + case pendingFunding.initiator && whoseCommit.IsRemote(): remoteAssets = chanAssets - case !pendingFunding.initiator && localCommit: + case !pendingFunding.initiator && whoseCommit.IsLocal(): remoteAssets = chanAssets - case !pendingFunding.initiator && !localCommit: + case !pendingFunding.initiator && whoseCommit.IsRemote(): localAssets = chanAssets } @@ -440,9 +439,9 @@ func newCommitBlobAndLeaves(pendingFunding *pendingAssetFunding, // With all the above, we'll generate the first commitment that'll be // stored _, firstCommit, err := GenerateCommitmentAllocations( - fakePrevState, lndOpenChan, assetOpenChan, localCommit, + fakePrevState, lndOpenChan, assetOpenChan, whoseCommit, localSatBalance, remoteSatBalance, fakeView, - pendingFunding.chainParams, keyRing, + pendingFunding.chainParams, keyRing.GetForParty(whoseCommit), ) if err != nil { return nil, lnwallet.CommitAuxLeaves{}, err @@ -481,13 +480,13 @@ func (p *pendingAssetFunding) toAuxFundingDesc( // Encode the commitment blobs for both the local and remote party. // This will be the information for the very first state (state 0). localCommitBlob, localAuxLeaves, err := newCommitBlobAndLeaves( - p, req.openChan, openChanDesc, req.localKeyRing, true, + p, req.openChan, openChanDesc, req.keyRing, lntypes.Local, ) if err != nil { return nil, err } remoteCommitBlob, remoteAuxLeaves, err := newCommitBlobAndLeaves( - p, req.openChan, openChanDesc, req.remoteKeyRing, false, + p, req.openChan, openChanDesc, req.keyRing, lntypes.Remote, ) if err != nil { return nil, err @@ -607,7 +606,7 @@ type fundingFlowIndex map[funding.PendingChanID]*pendingAssetFunding // fromMsg attempts to match an incoming message to the pending funding flow, // and extracts the asset proof from the message. func (f *fundingFlowIndex) fromMsg(chainParams *address.ChainParams, - msg protofsm.PeerMsg) (cmsg.AssetFundingMsg, *pendingAssetFunding, + msg msgmux.PeerMsg) (cmsg.AssetFundingMsg, *pendingAssetFunding, error) { assetProof, err := msgToAssetProof(msg.Message) @@ -1199,7 +1198,7 @@ func (f *FundingController) completeChannelFunding(ctx context.Context, // This is used to advance the state machine of an incoming funding flow. func (f *FundingController) processFundingMsg(ctx context.Context, fundingFlows fundingFlowIndex, - msg protofsm.PeerMsg) (funding.PendingChanID, error) { + msg msgmux.PeerMsg) (funding.PendingChanID, error) { var tempPID funding.PendingChanID @@ -1779,39 +1778,42 @@ func (f *FundingController) FundChannel(ctx context.Context, // due to prior custom channel messages, and maybe returns an aux funding desc // which can be used to modify how a channel is funded. func (f *FundingController) DescFromPendingChanID(pid funding.PendingChanID, - openChan *channeldb.OpenChannel, localKeyRing, - remoteKeyRing lnwallet.CommitmentKeyRing, - initiator bool) (lfn.Option[lnwallet.AuxFundingDesc], error) { + openChan lnwallet.AuxChanState, + keyRing lntypes.Dual[lnwallet.CommitmentKeyRing], + initiator bool) funding.AuxFundingDescResult { + + type returnType = lfn.Option[lnwallet.AuxFundingDesc] req := &bindFundingReq{ pendingChanID: pid, initiator: initiator, openChan: openChan, - localKeyRing: localKeyRing, - remoteKeyRing: remoteKeyRing, + keyRing: keyRing, resp: make( chan lfn.Option[lnwallet.AuxFundingDesc], 1, ), } if !fn.SendOrQuit(f.bindFundingReqs, req, f.Quit) { - return lfn.None[lnwallet.AuxFundingDesc](), - fmt.Errorf("timeout when sending to funding controller") + return lfn.Err[returnType](fmt.Errorf("timeout when sending " + + "to funding controller")) } resp, err := fn.RecvResp(req.resp, nil, f.Quit) if err != nil { - return lfn.None[lnwallet.AuxFundingDesc](), - fmt.Errorf("timeout when waiting for response: %w", err) + return lfn.Err[returnType](fmt.Errorf("timeout when waiting "+ + "for response: %w", err)) } - return resp, nil + return lfn.Ok(resp) } // DeriveTapscriptRoot returns the tapscript root for the channel identified by // the pid. If we don't have any information about the channel, we return None. func (f *FundingController) DeriveTapscriptRoot( - pid funding.PendingChanID) (lfn.Option[chainhash.Hash], error) { + pid funding.PendingChanID) funding.AuxTapscriptResult { + + type returnType = lfn.Option[chainhash.Hash] req := &assetRootReq{ pendingChanID: pid, @@ -1819,22 +1821,22 @@ func (f *FundingController) DeriveTapscriptRoot( } if !fn.SendOrQuit(f.rootReqs, req, f.Quit) { - return lfn.None[chainhash.Hash](), - fmt.Errorf("timeout when sending to funding controller") + return lfn.Err[returnType](fmt.Errorf("timeout when sending " + + "to funding controller")) } resp, err := fn.RecvResp(req.resp, nil, f.Quit) if err != nil { - return lfn.None[chainhash.Hash](), - fmt.Errorf("timeout when waiting for response: %w", err) + return lfn.Err[returnType](fmt.Errorf("timeout when waiting "+ + "for response: %w", err)) } - return resp, nil + return lfn.Ok(resp) } // ChannelReady is called when a channel has been fully opened and is ready to // be used. This can be used to perform any final setup or cleanup. -func (f *FundingController) ChannelReady(channel *channeldb.OpenChannel) error { +func (f *FundingController) ChannelReady(channel lnwallet.AuxChanState) error { // Currently, there is only something we need to do if we are the // responder of a channel funding. Since we're going to be swapping // assets for BTC, we need to have a buy offer ready for the channel @@ -1891,7 +1893,7 @@ func (f *FundingController) Name() string { } // CanHandle returns true if the target message can be routed to this endpoint. -func (f *FundingController) CanHandle(msg protofsm.PeerMsg) bool { +func (f *FundingController) CanHandle(msg msgmux.PeerMsg) bool { log.Tracef("Request to handle: %T", msg.Message) log.Tracef("Request to handle: %v", int64(msg.MsgType())) @@ -1926,7 +1928,7 @@ func (f *FundingController) CanHandle(msg protofsm.PeerMsg) bool { // SendMessage handles the target message, and returns true if the message was // able being processed. -func (f *FundingController) SendMessage(msg protofsm.PeerMsg) bool { +func (f *FundingController) SendMessage(msg msgmux.PeerMsg) bool { return fn.SendOrQuit(f.msgs, msg, f.Quit) } diff --git a/tapchannel/aux_leaf_creator.go b/tapchannel/aux_leaf_creator.go index ba05ccd59..6d3338552 100644 --- a/tapchannel/aux_leaf_creator.go +++ b/tapchannel/aux_leaf_creator.go @@ -12,8 +12,7 @@ import ( "github.com/lightningnetwork/lnd/channeldb" lfn "github.com/lightningnetwork/lnd/fn" "github.com/lightningnetwork/lnd/input" - "github.com/lightningnetwork/lnd/lnwallet" - "github.com/lightningnetwork/lnd/lnwire" + lnwl "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/tlv" ) @@ -26,40 +25,37 @@ const ( // FetchLeavesFromView attempts to fetch the auxiliary leaves that correspond to // the passed aux blob, and pending fully evaluated HTLC view. func FetchLeavesFromView(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, prevBlob tlv.Blob, - originalView *lnwallet.HtlcView, isOurCommit bool, ourBalance, - theirBalance lnwire.MilliSatoshi, - keys lnwallet.CommitmentKeyRing) (lfn.Option[lnwallet.CommitAuxLeaves], - lnwallet.CommitSortFunc, error) { + in lnwl.CommitDiffAuxInput) lfn.Result[lnwl.CommitDiffAuxResult] { - none := lfn.None[lnwallet.CommitAuxLeaves]() + type returnType = lnwl.CommitDiffAuxResult // If the channel has no custom blob, we don't need to do anything. - if chanState.CustomBlob.IsNone() { - return none, nil, nil + if in.ChannelState.CustomBlob.IsNone() { + return lfn.Ok(lnwl.CommitDiffAuxResult{}) } chanAssetState, err := cmsg.DecodeOpenChannel( - chanState.CustomBlob.UnsafeFromSome(), + in.ChannelState.CustomBlob.UnsafeFromSome(), ) if err != nil { - return none, nil, fmt.Errorf("unable to decode channel asset "+ - "state: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable to decode "+ + "channel asset state: %w", err)) } - prevState, err := cmsg.DecodeCommitment(prevBlob) + prevState, err := cmsg.DecodeCommitment(in.PrevBlob) if err != nil { - return none, nil, fmt.Errorf("unable to decode prev commit "+ - "state: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable to decode prev "+ + "commit state: %w", err)) } allocations, newCommitment, err := GenerateCommitmentAllocations( - prevState, chanState, chanAssetState, isOurCommit, ourBalance, - theirBalance, originalView, chainParams, keys, + prevState, in.ChannelState, chanAssetState, in.WhoseCommit, + in.OurBalance, in.TheirBalance, in.UnfilteredView, chainParams, + in.KeyRing, ) if err != nil { - return none, nil, fmt.Errorf("unable to generate allocations: "+ - "%w", err) + return lfn.Err[returnType](fmt.Errorf("unable to generate "+ + "allocations: %w", err)) } customCommitSort := func(tx *wire.MsgTx, cltvs []uint32, @@ -70,28 +66,33 @@ func FetchLeavesFromView(chainParams *address.ChainParams, ) } - return lfn.Some(newCommitment.Leaves()), customCommitSort, nil + return lfn.Ok(lnwl.CommitDiffAuxResult{ + AuxLeaves: lfn.Some(newCommitment.Leaves()), + CommitSortFunc: lfn.Some[lnwl.CommitSortFunc]( + customCommitSort, + ), + }) } // FetchLeavesFromCommit attempts to fetch the auxiliary leaves that correspond // to the passed aux blob, and an existing channel commitment. func FetchLeavesFromCommit(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, com channeldb.ChannelCommitment, - keys lnwallet.CommitmentKeyRing) (lfn.Option[lnwallet.CommitAuxLeaves], - error) { + chanState lnwl.AuxChanState, com channeldb.ChannelCommitment, + keys lnwl.CommitmentKeyRing) lfn.Result[lnwl.CommitDiffAuxResult] { - none := lfn.None[lnwallet.CommitAuxLeaves]() + type returnType = lnwl.CommitDiffAuxResult // If the commitment has no custom blob, we don't need to do anything. if com.CustomBlob.IsNone() { - return none, nil + return lfn.Ok(lnwl.CommitDiffAuxResult{}) } commitment, err := cmsg.DecodeCommitment( com.CustomBlob.UnsafeFromSome(), ) if err != nil { - return none, fmt.Errorf("unable to decode commitment: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable to decode "+ + "commitment: %w", err)) } incomingHtlcs := commitment.IncomingHtlcAssets.Val.HtlcOutputs @@ -119,8 +120,9 @@ func FetchLeavesFromCommit(chainParams *address.ChainParams, keys, chainParams, htlcOutputs, ) if err != nil { - return none, fmt.Errorf("unable to create "+ - "second level HTLC leaf: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable "+ + "to create second level HTLC leaf: %w", + err)) } existingLeaf := lfn.MapOption( @@ -150,8 +152,9 @@ func FetchLeavesFromCommit(chainParams *address.ChainParams, keys, chainParams, htlcOutputs, ) if err != nil { - return none, fmt.Errorf("unable to create "+ - "second level HTLC leaf: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable "+ + "to create second level HTLC leaf: %w", + err)) } existingLeaf := lfn.MapOption( @@ -169,76 +172,77 @@ func FetchLeavesFromCommit(chainParams *address.ChainParams, } } - return lfn.Some(commitment.Leaves()), nil + return lfn.Ok(lnwl.CommitDiffAuxResult{ + AuxLeaves: lfn.Some(commitment.Leaves()), + }) } // FetchLeavesFromRevocation attempts to fetch the auxiliary leaves // from a channel revocation that stores balance + blob information. func FetchLeavesFromRevocation( - rev *channeldb.RevocationLog) (lfn.Option[lnwallet.CommitAuxLeaves], - error) { + r *channeldb.RevocationLog) lfn.Result[lnwl.CommitDiffAuxResult] { - none := lfn.None[lnwallet.CommitAuxLeaves]() + type returnType = lnwl.CommitDiffAuxResult - // If the revocation has no custom blob, we don't need to do anything. - if rev.CustomBlob.ValOpt().IsNone() { - return none, nil - } + return lfn.MapOptionZ( + r.CustomBlob.ValOpt(), + func(blob tlv.Blob) lfn.Result[lnwl.CommitDiffAuxResult] { + commitment, err := cmsg.DecodeCommitment(blob) + if err != nil { + return lfn.Err[returnType](fmt.Errorf("unable "+ + "to decode commitment: %w", err)) + } - commitment, err := cmsg.DecodeCommitment( - rev.CustomBlob.ValOpt().UnsafeFromSome(), + return lfn.Ok(lnwl.CommitDiffAuxResult{ + AuxLeaves: lfn.Some(commitment.Leaves()), + }) + }, ) - if err != nil { - return none, fmt.Errorf("unable to decode commitment: %w", err) - } - - return lfn.Some(commitment.Leaves()), nil } // ApplyHtlcView serves as the state transition function for the custom // channel's blob. Given the old blob, and an HTLC view, then a new // blob should be returned that reflects the pending updates. func ApplyHtlcView(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, prevBlob tlv.Blob, - originalView *lnwallet.HtlcView, isOurCommit bool, - ourBalance, theirBalance lnwire.MilliSatoshi, - keys lnwallet.CommitmentKeyRing) (lfn.Option[tlv.Blob], error) { + in lnwl.CommitDiffAuxInput) lfn.Result[lfn.Option[tlv.Blob]] { - none := lfn.None[tlv.Blob]() + type returnType = lfn.Option[tlv.Blob] // If the channel has no custom blob, we don't need to do anything. - if chanState.CustomBlob.IsNone() { - return none, nil + if in.ChannelState.CustomBlob.IsNone() { + return lfn.Ok(lfn.None[tlv.Blob]()) } chanAssetState, err := cmsg.DecodeOpenChannel( - chanState.CustomBlob.UnsafeFromSome(), + in.ChannelState.CustomBlob.UnsafeFromSome(), ) if err != nil { - return none, fmt.Errorf("unable to decode channel asset "+ - "state: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable to decode "+ + "channel asset state: %w", err)) } - prevState, err := cmsg.DecodeCommitment(prevBlob) + prevState, err := cmsg.DecodeCommitment(in.PrevBlob) if err != nil { - return none, fmt.Errorf("unable to decode prev commit state: "+ - "%w", err) + return lfn.Err[returnType](fmt.Errorf("unable to decode prev "+ + "commit state: %w", err)) } _, newCommitment, err := GenerateCommitmentAllocations( - prevState, chanState, chanAssetState, isOurCommit, ourBalance, - theirBalance, originalView, chainParams, keys, + prevState, in.ChannelState, chanAssetState, in.WhoseCommit, + in.OurBalance, in.TheirBalance, in.UnfilteredView, chainParams, + in.KeyRing, ) if err != nil { - return none, fmt.Errorf("unable to generate allocations: %w", - err) + return lfn.Err[returnType](fmt.Errorf("unable to generate "+ + "allocations: %w", err)) } var buf bytes.Buffer err = newCommitment.Encode(&buf) if err != nil { - return none, fmt.Errorf("unable to encode commitment: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable to encode "+ + "commitment: %w", err)) } - return lfn.Some(buf.Bytes()), nil + return lfn.Ok(lfn.Some(buf.Bytes())) } diff --git a/tapchannel/aux_leaf_signer.go b/tapchannel/aux_leaf_signer.go index 114e10851..f7d73078e 100644 --- a/tapchannel/aux_leaf_signer.go +++ b/tapchannel/aux_leaf_signer.go @@ -19,9 +19,9 @@ import ( "github.com/lightninglabs/taproot-assets/tappsbt" "github.com/lightninglabs/taproot-assets/tapscript" "github.com/lightninglabs/taproot-assets/vm" - "github.com/lightningnetwork/lnd/channeldb" lfn "github.com/lightningnetwork/lnd/fn" "github.com/lightningnetwork/lnd/input" + "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/btcwallet" "github.com/lightningnetwork/lnd/lnwire" @@ -100,7 +100,7 @@ func (s *AuxLeafSigner) Stop() error { // SubmitSecondLevelSigBatch takes a batch of aux sign jobs and processes them // asynchronously. func (s *AuxLeafSigner) SubmitSecondLevelSigBatch( - chanState *channeldb.OpenChannel, commitTx *wire.MsgTx, + chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, jobs []lnwallet.AuxSigJob) error { s.Wg.Add(1) @@ -111,7 +111,9 @@ func (s *AuxLeafSigner) SubmitSecondLevelSigBatch( // PackSigs takes a series of aux signatures and packs them into a single blob // that can be sent alongside the CommitSig messages. -func PackSigs(sigBlob []lfn.Option[tlv.Blob]) (lfn.Option[tlv.Blob], error) { +func PackSigs(sigBlob []lfn.Option[tlv.Blob]) lfn.Result[lfn.Option[tlv.Blob]] { + type returnType = lfn.Option[tlv.Blob] + htlcSigs := make([][]*cmsg.AssetSig, len(sigBlob)) for idx := range sigBlob { err := lfn.MapOptionZ( @@ -129,8 +131,8 @@ func PackSigs(sigBlob []lfn.Option[tlv.Blob]) (lfn.Option[tlv.Blob], error) { }, ) if err != nil { - return lfn.None[tlv.Blob](), fmt.Errorf("error "+ - "decoding asset sig list record: %w", err) + return lfn.Err[returnType](fmt.Errorf("error "+ + "decoding asset sig list record: %w", err)) } } @@ -138,23 +140,26 @@ func PackSigs(sigBlob []lfn.Option[tlv.Blob]) (lfn.Option[tlv.Blob], error) { var buf bytes.Buffer if err := commitSig.Encode(&buf); err != nil { - return lfn.None[tlv.Blob](), fmt.Errorf("error encoding "+ - "commit sig: %w", err) + return lfn.Err[returnType](fmt.Errorf("error encoding "+ + "commit sig: %w", err)) } - return lfn.Some(buf.Bytes()), nil + return lfn.Ok(lfn.Some(buf.Bytes())) } // UnpackSigs takes a packed blob of signatures and returns the original // signatures for each HTLC, keyed by HTLC index. -func UnpackSigs(blob lfn.Option[tlv.Blob]) ([]lfn.Option[tlv.Blob], error) { +func UnpackSigs(blob lfn.Option[tlv.Blob]) lfn.Result[[]lfn.Option[tlv.Blob]] { + type returnType = []lfn.Option[tlv.Blob] + if blob.IsNone() { - return nil, nil + return lfn.Ok[returnType](nil) } commitSig, err := cmsg.DecodeCommitSig(blob.UnsafeFromSome()) if err != nil { - return nil, fmt.Errorf("error decoding commit sig: %w", err) + return lfn.Err[returnType](fmt.Errorf("error decoding commit "+ + "sig: %w", err)) } htlcSigRec := commitSig.HtlcPartialSigs.Val.HtlcPartialSigs @@ -163,13 +168,13 @@ func UnpackSigs(blob lfn.Option[tlv.Blob]) ([]lfn.Option[tlv.Blob], error) { htlcSigs[idx] = lfn.Some(htlcSigRec[idx].Bytes()) } - return htlcSigs, nil + return lfn.Ok(htlcSigs) } // VerifySecondLevelSigs attempts to synchronously verify a batch of aux sig // jobs. func VerifySecondLevelSigs(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, commitTx *wire.MsgTx, + chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, verifyJobs []lnwallet.AuxVerifyJob) error { for idx := range verifyJobs { @@ -238,7 +243,7 @@ func VerifySecondLevelSigs(chainParams *address.ChainParams, // processAuxSigBatch processes a batch of aux sign jobs asynchronously. // // NOTE: This method must be called as a goroutine. -func (s *AuxLeafSigner) processAuxSigBatch(chanState *channeldb.OpenChannel, +func (s *AuxLeafSigner) processAuxSigBatch(chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, sigJobs []lnwallet.AuxSigJob) { defer s.Wg.Done() @@ -349,7 +354,7 @@ func (s *AuxLeafSigner) processAuxSigBatch(chanState *channeldb.OpenChannel, // verifyHtlcSignature verifies the HTLC signature in the commitment transaction // described by the sign job. func verifyHtlcSignature(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, commitTx *wire.MsgTx, + chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, keyRing lnwallet.CommitmentKeyRing, sigs []*cmsg.AssetSig, htlcOutputs []*cmsg.AssetOutput, baseJob lnwallet.BaseAuxJob) error { @@ -388,10 +393,10 @@ func verifyHtlcSignature(chainParams *address.ChainParams, // We are always verifying the signature of the remote party, // which are for our commitment transaction. - const isOurCommit = true + const whoseCommit = lntypes.Local htlcScript, err := lnwallet.GenTaprootHtlcScript( - baseJob.Incoming, isOurCommit, baseJob.HTLC.Timeout, + baseJob.Incoming, whoseCommit, baseJob.HTLC.Timeout, baseJob.HTLC.RHash, &keyRing, lfn.None[txscript.TapLeaf](), ) @@ -484,7 +489,7 @@ func applySignDescToVIn(signDesc input.SignDescriptor, vIn *tappsbt.VInput, // generateHtlcSignature generates the signature for the HTLC output in the // commitment transaction described by the sign job. -func (s *AuxLeafSigner) generateHtlcSignature(chanState *channeldb.OpenChannel, +func (s *AuxLeafSigner) generateHtlcSignature(chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, htlcOutputs []*cmsg.AssetOutput, signDesc input.SignDescriptor, baseJob lnwallet.BaseAuxJob) (lnwallet.AuxSigJobResp, error) { @@ -499,11 +504,11 @@ func (s *AuxLeafSigner) generateHtlcSignature(chanState *channeldb.OpenChannel, } // We are always signing the commitment transaction of the remote party, - // which is why we set isOurCommit to false. - const isOurCommit = false + // which is why we set whoseCommit to remote. + const whoseCommit = lntypes.Remote htlcScript, err := lnwallet.GenTaprootHtlcScript( - baseJob.Incoming, isOurCommit, baseJob.HTLC.Timeout, + baseJob.Incoming, whoseCommit, baseJob.HTLC.Timeout, baseJob.HTLC.RHash, &baseJob.KeyRing, lfn.None[txscript.TapLeaf](), ) @@ -577,7 +582,7 @@ func (s *AuxLeafSigner) generateHtlcSignature(chanState *channeldb.OpenChannel, // the commitment transaction. A bool is returned indicating if the HTLC was // incoming or outgoing. func htlcSecondLevelPacketsFromCommit(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, commitTx *wire.MsgTx, + chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, keyRing lnwallet.CommitmentKeyRing, htlcOutputs []*cmsg.AssetOutput, baseJob lnwallet.BaseAuxJob) ([]*tappsbt.VPacket, error) { diff --git a/tapchannel/aux_sweeper.go b/tapchannel/aux_sweeper.go index 0a42a4b3f..cbacc3c54 100644 --- a/tapchannel/aux_sweeper.go +++ b/tapchannel/aux_sweeper.go @@ -1566,6 +1566,23 @@ func (a *AuxSweeper) DeriveSweepAddr(inputs []input.Input, return resp } +// ExtraBudgetForInputs takes a set of inputs and maybe returns an extra budget +// that should be added to the sweep transaction. +func (a *AuxSweeper) ExtraBudgetForInputs( + inputs []input.Input) lfn.Result[btcutil.Amount] { + + hasResolutionBlob := fn.Any(inputs, func(i input.Input) bool { + return i.ResolutionBlob().IsSome() + }) + + var extraBudget btcutil.Amount + if hasResolutionBlob { + extraBudget = tapsend.DummyAmtSats + } + + return lfn.Ok(extraBudget) +} + // NotifyBroadcast is used to notify external callers of the broadcast of a // sweep transaction, generated by the passed BumpRequest. func (a *AuxSweeper) NotifyBroadcast(req *sweep.BumpRequest, diff --git a/tapchannel/aux_traffic_shaper.go b/tapchannel/aux_traffic_shaper.go index 08b7b82e0..4507676c4 100644 --- a/tapchannel/aux_traffic_shaper.go +++ b/tapchannel/aux_traffic_shaper.go @@ -86,12 +86,12 @@ func (s *AuxTrafficShaper) Stop() error { // routing.TlvTrafficShaper interface. var _ routing.TlvTrafficShaper = (*AuxTrafficShaper)(nil) -// HandleTraffic is called in order to check if the channel identified by the -// provided channel ID is handled by the traffic shaper implementation. If it -// is handled by the traffic shaper, then the normal bandwidth calculation can -// be skipped and the bandwidth returned by PaymentBandwidth should be used +// ShouldHandleTraffic is called in order to check if the channel identified by +// the provided channel ID is handled by the traffic shaper implementation. If +// it is handled by the traffic shaper, then the normal bandwidth calculation +// can be skipped and the bandwidth returned by PaymentBandwidth should be used // instead. -func (s *AuxTrafficShaper) HandleTraffic(_ lnwire.ShortChannelID, +func (s *AuxTrafficShaper) ShouldHandleTraffic(_ lnwire.ShortChannelID, fundingBlob lfn.Option[tlv.Blob]) (bool, error) { // If there is no auxiliary blob in the channel, it's not a custom @@ -199,8 +199,8 @@ func (s *AuxTrafficShaper) PaymentBandwidth(htlcBlob, // blob of an HTLC, may produce a different blob or modify the amount of bitcoin // this HTLC should carry. func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, - htlcCustomRecords lnwire.CustomRecords) (lnwire.MilliSatoshi, tlv.Blob, - error) { + htlcCustomRecords lnwire.CustomRecords) (lnwire.MilliSatoshi, + lnwire.CustomRecords, error) { if len(htlcCustomRecords) == 0 { return totalAmount, nil, nil @@ -208,13 +208,7 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, // We need to do a round trip to convert the custom records to a blob // that we can then parse into the correct struct again. - htlcBlob, err := htlcCustomRecords.Serialize() - if err != nil { - return 0, nil, fmt.Errorf("error serializing HTLC blob: %w", - err) - } - - htlc, err := rfqmsg.DecodeHtlc(htlcBlob) + htlc, err := rfqmsg.HtlcFromCustomRecords(htlcCustomRecords) if err != nil { return 0, nil, fmt.Errorf("error decoding HTLC blob: %w", err) } @@ -223,7 +217,7 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, // keysend payment and don't need to do anything. We even return the // original on-chain amount as we don't want to change it. if htlc.Amounts.Val.Sum() > 0 { - return totalAmount, htlcBlob, nil + return totalAmount, htlcCustomRecords, nil } if htlc.RfqID.ValOpt().IsNone() { @@ -280,5 +274,10 @@ 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 := lnwire.NewMSatFromSatoshis(DefaultOnChainHtlcAmount) - return htlcAmountMSat, htlc.Bytes(), nil + updatedRecords, err := htlc.ToCustomRecords() + if err != nil { + return 0, nil, fmt.Errorf("error encoding HTLC blob: %w", err) + } + + return htlcAmountMSat, updatedRecords, nil } diff --git a/tapchannel/commitment.go b/tapchannel/commitment.go index 21035acea..c1a151360 100644 --- a/tapchannel/commitment.go +++ b/tapchannel/commitment.go @@ -23,6 +23,7 @@ import ( lfn "github.com/lightningnetwork/lnd/fn" "github.com/lightningnetwork/lnd/input" "github.com/lightningnetwork/lnd/keychain" + "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/lightningnetwork/lnd/lnwire" @@ -32,8 +33,8 @@ import ( // the decoded asset balances of the HTLC to avoid multiple decoding round // trips. type DecodedDescriptor struct { - // PaymentDescriptor is the original payment descriptor. - *lnwallet.PaymentDescriptor + // AuxHtlcDescriptor is the original payment descriptor. + lnwallet.AuxHtlcDescriptor // AssetBalances is the decoded asset balances of the HTLC. AssetBalances []*rfqmsg.AssetBalance @@ -57,19 +58,19 @@ type DecodedView struct { // settles, timeouts and fee updates found in both logs. The resulting view // returned reflects the current state of HTLCs within the remote or local // commitment chain, and the current commitment fee rate. -func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, - original *lnwallet.HtlcView) (uint64, uint64, *DecodedView, - *lnwallet.HtlcView, error) { +func ComputeView(ourBalance, theirBalance uint64, + whoseCommit lntypes.ChannelParty, original *lnwallet.HtlcView) (uint64, + uint64, *DecodedView, *DecodedView, error) { - log.Tracef("Computing view, ourCommit=%v, ourAssetBalance=%d, "+ + log.Tracef("Computing view, whoseCommit=%v, ourAssetBalance=%d, "+ "theirAssetBalance=%d, ourUpdates=%d, theirUpdates=%d", - isOurCommit, ourBalance, theirBalance, len(original.OurUpdates), + whoseCommit, ourBalance, theirBalance, len(original.OurUpdates), len(original.TheirUpdates)) newView := &DecodedView{ FeePerKw: original.FeePerKw, } - nonAssetView := &lnwallet.HtlcView{ + nonAssetView := &DecodedView{ FeePerKw: original.FeePerKw, } @@ -89,22 +90,22 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, // Only the add HTLCs have the custom blobs, so we'll make an index of // them so we can look them up to decide how to handle the // settle/remove entries. - localHtlcIndex := make(map[uint64]*lnwallet.PaymentDescriptor) - remoteHtlcIndex := make(map[uint64]*lnwallet.PaymentDescriptor) + localHtlcIndex := make(map[uint64]lnwallet.AuxHtlcDescriptor) + remoteHtlcIndex := make(map[uint64]lnwallet.AuxHtlcDescriptor) - for _, entry := range original.OurUpdates { + for _, entry := range original.AuxOurUpdates() { if entry.EntryType == lnwallet.Add { localHtlcIndex[entry.HtlcIndex] = entry } } - for _, entry := range original.TheirUpdates { + for _, entry := range original.AuxTheirUpdates() { if entry.EntryType == lnwallet.Add { remoteHtlcIndex[entry.HtlcIndex] = entry } } local, remote := ourBalance, theirBalance - for _, entry := range original.OurUpdates { + for _, entry := range original.AuxOurUpdates() { switch entry.EntryType { // Skip adds for now, they will be processed below. case lnwallet.Add: @@ -137,18 +138,18 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, } decodedEntry := &DecodedDescriptor{ - PaymentDescriptor: entry, + AuxHtlcDescriptor: entry, AssetBalances: assetHtlc.Balances(), } local, remote = processRemoveEntry( decodedEntry, local, remote, - isOurCommit, true, nextHeight, + whoseCommit, true, nextHeight, ) } } } - for _, entry := range original.TheirUpdates { + for _, entry := range original.AuxTheirUpdates() { switch entry.EntryType { // Skip adds for now, they will be processed below. case lnwallet.Add: @@ -181,12 +182,12 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, } decodedEntry := &DecodedDescriptor{ - PaymentDescriptor: entry, + AuxHtlcDescriptor: entry, AssetBalances: assetHtlc.Balances(), } local, remote = processRemoveEntry( decodedEntry, local, remote, - isOurCommit, false, nextHeight, + whoseCommit, false, nextHeight, ) } } @@ -195,7 +196,7 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, // Next we take a second pass through all the log entries, skipping any // settled HTLCs, and debiting the chain state balance due to any newly // added HTLCs. - for _, entry := range original.OurUpdates { + for _, entry := range original.AuxOurUpdates() { isAdd := entry.EntryType == lnwallet.Add // Skip any entries that aren't adds or adds that were already @@ -210,7 +211,9 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, // correctly. if len(entry.CustomRecords) == 0 { nonAssetView.OurUpdates = append( - nonAssetView.OurUpdates, entry, + nonAssetView.OurUpdates, &DecodedDescriptor{ + AuxHtlcDescriptor: entry, + }, ) continue @@ -225,17 +228,17 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, } decodedEntry := &DecodedDescriptor{ - PaymentDescriptor: entry, + AuxHtlcDescriptor: entry, AssetBalances: assetHtlc.Balances(), } local, remote = processAddEntry( - decodedEntry, local, remote, isOurCommit, false, + decodedEntry, local, remote, whoseCommit, false, nextHeight, ) newView.OurUpdates = append(newView.OurUpdates, decodedEntry) } - for _, entry := range original.TheirUpdates { + for _, entry := range original.AuxTheirUpdates() { isAdd := entry.EntryType == lnwallet.Add // Skip any entries that aren't adds or adds that were already @@ -250,7 +253,9 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, // correctly. if len(entry.CustomRecords) == 0 { nonAssetView.TheirUpdates = append( - nonAssetView.TheirUpdates, entry, + nonAssetView.TheirUpdates, &DecodedDescriptor{ + AuxHtlcDescriptor: entry, + }, ) continue @@ -265,11 +270,11 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, } decodedEntry := &DecodedDescriptor{ - PaymentDescriptor: entry, + AuxHtlcDescriptor: entry, AssetBalances: assetHtlc.Balances(), } local, remote = processAddEntry( - decodedEntry, local, remote, isOurCommit, true, + decodedEntry, local, remote, whoseCommit, true, nextHeight, ) @@ -284,14 +289,12 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, // processRemoveEntry processes the removal of an HTLC from the commitment // transaction. It returns the updated balances for both parties. func processRemoveEntry(htlc *DecodedDescriptor, ourBalance, - theirBalance uint64, isOurCommit, isIncoming bool, + theirBalance uint64, whoseCommit lntypes.ChannelParty, isIncoming bool, nextHeight uint64) (uint64, uint64) { // Ignore any removal entries which have already been processed. - removeHeight := lnwallet.RemoveHeight( - htlc.PaymentDescriptor, !isOurCommit, - ) - if *removeHeight != nextHeight { + removeHeight := htlc.RemoveHeight(whoseCommit) + if removeHeight != nextHeight { return ourBalance, theirBalance } @@ -332,11 +335,12 @@ func processRemoveEntry(htlc *DecodedDescriptor, ourBalance, // processAddEntry processes the addition of an HTLC to the commitment // transaction. It returns the updated balances for both parties. func processAddEntry(htlc *DecodedDescriptor, ourBalance, theirBalance uint64, - isOurCommit, isIncoming bool, nextHeight uint64) (uint64, uint64) { + whoseCommit lntypes.ChannelParty, isIncoming bool, + nextHeight uint64) (uint64, uint64) { // Ignore any add entries which have already been processed. - addHeight := lnwallet.AddHeight(htlc.PaymentDescriptor, !isOurCommit) - if *addHeight != nextHeight { + addHeight := htlc.AddHeight(whoseCommit) + if addHeight != nextHeight { return ourBalance, theirBalance } @@ -360,12 +364,12 @@ func processAddEntry(htlc *DecodedDescriptor, ourBalance, theirBalance uint64, // and/or remote anchor output. func SanityCheckAmounts(ourBalance, theirBalance btcutil.Amount, ourAssetBalance, theirAssetBalance uint64, view *DecodedView, - chanType channeldb.ChannelType, isOurs bool, + chanType channeldb.ChannelType, whoseCommit lntypes.ChannelParty, dustLimit btcutil.Amount) (bool, bool, error) { - log.Tracef("Sanity checking amounts, ourCommit=%v, ourBalance=%d, "+ + log.Tracef("Sanity checking amounts, whoseCommit=%v, ourBalance=%d, "+ "theirBalance=%d, ourAssetBalance=%d, theirAssetBalance=%d", - isOurs, ourBalance, theirBalance, ourAssetBalance, + whoseCommit, ourBalance, theirBalance, ourAssetBalance, theirAssetBalance) var ( @@ -374,7 +378,7 @@ func SanityCheckAmounts(ourBalance, theirBalance btcutil.Amount, ) for _, entry := range view.OurUpdates { isDust := lnwallet.HtlcIsDust( - chanType, false, isOurs, feePerKw, + chanType, false, whoseCommit, feePerKw, entry.Amount.ToSatoshis(), dustLimit, ) if rfqmsg.Sum(entry.AssetBalances) > 0 && isDust { @@ -389,7 +393,7 @@ func SanityCheckAmounts(ourBalance, theirBalance btcutil.Amount, } for _, entry := range view.TheirUpdates { isDust := lnwallet.HtlcIsDust( - chanType, true, isOurs, feePerKw, + chanType, true, whoseCommit, feePerKw, entry.Amount.ToSatoshis(), dustLimit, ) if rfqmsg.Sum(entry.AssetBalances) > 0 && isDust { @@ -438,14 +442,15 @@ func SanityCheckAmounts(ourBalance, theirBalance btcutil.Amount, // GenerateCommitmentAllocations generates allocations for a channel commitment. func GenerateCommitmentAllocations(prevState *cmsg.Commitment, - chanState *channeldb.OpenChannel, chanAssetState *cmsg.OpenChannel, - isOurCommit bool, ourBalance, theirBalance lnwire.MilliSatoshi, - originalView *lnwallet.HtlcView, chainParams *address.ChainParams, + chanState lnwallet.AuxChanState, chanAssetState *cmsg.OpenChannel, + whoseCommit lntypes.ChannelParty, ourBalance, + theirBalance lnwire.MilliSatoshi, originalView *lnwallet.HtlcView, + chainParams *address.ChainParams, keys lnwallet.CommitmentKeyRing) ([]*Allocation, *cmsg.Commitment, error) { - log.Tracef("Generating allocations, ourCommit=%v, ourBalance=%d, "+ - "theirBalance=%d", isOurCommit, ourBalance, theirBalance) + log.Tracef("Generating allocations, whoseCommit=%v, ourBalance=%d, "+ + "theirBalance=%d", whoseCommit, ourBalance, theirBalance) // Everywhere we have a isOurCommit boolean we define the local/remote // balances as seen from the perspective of the local node. So if this @@ -455,7 +460,7 @@ func GenerateCommitmentAllocations(prevState *cmsg.Commitment, // work correctly. localAssetStartBalance := prevState.LocalAssets.Val.Sum() remoteAssetStartBalance := prevState.RemoteAssets.Val.Sum() - if !isOurCommit { + if whoseCommit.IsRemote() { localAssetStartBalance, remoteAssetStartBalance = remoteAssetStartBalance, localAssetStartBalance } @@ -464,19 +469,19 @@ func GenerateCommitmentAllocations(prevState *cmsg.Commitment, //nolint:lll ourAssetBalance, theirAssetBalance, filteredView, nonAssetView, err := ComputeView( localAssetStartBalance, remoteAssetStartBalance, - isOurCommit, originalView, + whoseCommit, originalView, ) if err != nil { return nil, nil, fmt.Errorf("unable to compute view: %w", err) } dustLimit := chanState.LocalChanCfg.DustLimit - if !isOurCommit { + if whoseCommit.IsRemote() { dustLimit = chanState.RemoteChanCfg.DustLimit } - log.Tracef("Computed view, ourCommit=%v, ourAssetBalance=%d, "+ - "theirAssetBalance=%d, dustLimit=%v", isOurCommit, + log.Tracef("Computed view, whoseCommit=%v, ourAssetBalance=%d, "+ + "theirAssetBalance=%d, dustLimit=%v", whoseCommit, ourAssetBalance, theirAssetBalance, dustLimit) // Make sure that every output that carries an asset balance has a @@ -484,7 +489,7 @@ func GenerateCommitmentAllocations(prevState *cmsg.Commitment, wantLocalAnchor, wantRemoteAnchor, err := SanityCheckAmounts( ourBalance.ToSatoshis(), theirBalance.ToSatoshis(), ourAssetBalance, theirAssetBalance, filteredView, - chanState.ChanType, isOurCommit, dustLimit, + chanState.ChanType, whoseCommit, dustLimit, ) if err != nil { return nil, nil, fmt.Errorf("error checking amounts: %w", err) @@ -497,15 +502,15 @@ func GenerateCommitmentAllocations(prevState *cmsg.Commitment, allocations, err := CreateAllocations( chanState, ourBalance.ToSatoshis(), theirBalance.ToSatoshis(), ourAssetBalance, theirAssetBalance, wantLocalAnchor, - wantRemoteAnchor, filteredView, isOurCommit, keys, nonAssetView, + wantRemoteAnchor, filteredView, whoseCommit, keys, nonAssetView, ) if err != nil { return nil, nil, fmt.Errorf("unable to create allocations: %w", err) } - log.Tracef("Created allocations, ourCommit=%v, allocations=%v", - isOurCommit, limitSpewer.Sdump(allocations)) + log.Tracef("Created allocations, whoseCommit=%v, allocations=%v", + whoseCommit, limitSpewer.Sdump(allocations)) inputProofs := fn.Map( chanAssetState.Assets(), @@ -592,18 +597,18 @@ func GenerateCommitmentAllocations(prevState *cmsg.Commitment, } // CreateAllocations creates the allocations for the channel state. -func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, +func CreateAllocations(chanState lnwallet.AuxChanState, ourBalance, theirBalance btcutil.Amount, ourAssetBalance, theirAssetBalance uint64, wantLocalCommitAnchor, wantRemoteCommitAnchor bool, - filteredView *DecodedView, isOurCommit bool, + filteredView *DecodedView, whoseCommit lntypes.ChannelParty, keys lnwallet.CommitmentKeyRing, - nonAssetView *lnwallet.HtlcView) ([]*Allocation, error) { + nonAssetView *DecodedView) ([]*Allocation, error) { - log.Tracef("Creating allocations, ourCommit=%v, initiator=%v, "+ + log.Tracef("Creating allocations, whoseCommit=%v, initiator=%v, "+ "ourBalance=%d, theirBalance=%d, ourAssetBalance=%d, "+ "theirAssetBalance=%d, wantLocalCommitAnchor=%v, "+ "wantRemoteCommitAnchor=%v, ourUpdates=%d, theirUpdates=%d, "+ - "nonAssetOurUpdates=%d, nonAssetTheirUpdates=%d", isOurCommit, + "nonAssetOurUpdates=%d, nonAssetTheirUpdates=%d", whoseCommit, chanState.IsInitiator, ourBalance, theirBalance, ourAssetBalance, theirAssetBalance, wantLocalCommitAnchor, wantRemoteCommitAnchor, @@ -640,7 +645,7 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, } var err error - if isOurCommit { + if whoseCommit.IsLocal() { err = addCommitmentOutputs( chanState.ChanType, &chanState.LocalChanCfg, &chanState.RemoteChanCfg, chanState.IsInitiator, @@ -672,7 +677,7 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, var haveHtlcSplitRoot bool addHtlc := func(htlc *DecodedDescriptor, isIncoming bool) error { htlcScript, err := lnwallet.GenTaprootHtlcScript( - isIncoming, isOurCommit, htlc.Timeout, htlc.RHash, + isIncoming, whoseCommit, htlc.Timeout, htlc.RHash, &keys, lfn.None[txscript.TapLeaf](), ) if err != nil { @@ -754,11 +759,11 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, // Finally, we add the non-asset HTLC outputs. These are HTLCs that // don't carry any asset balance, but are still part of the commitment // transaction. - addNonAssetHtlc := func(htlc *lnwallet.PaymentDescriptor, + addNonAssetHtlc := func(htlc *DecodedDescriptor, isIncoming bool) error { htlcScript, err := lnwallet.GenTaprootHtlcScript( - isIncoming, isOurCommit, htlc.Timeout, htlc.RHash, + isIncoming, whoseCommit, htlc.Timeout, htlc.RHash, &keys, lfn.None[txscript.TapLeaf](), ) if err != nil { @@ -1101,7 +1106,7 @@ func ToCommitment(allocations []*Allocation, } if auxLeaves.OutgoingHtlcLeaves == nil { - auxLeaves.OutgoingHtlcLeaves = make(input.AuxTapLeaves) + auxLeaves.OutgoingHtlcLeaves = make(input.HtlcAuxLeaves) } auxLeaves.OutgoingHtlcLeaves[a.HtlcIndex] = input.HtlcAuxLeaf{ @@ -1132,7 +1137,7 @@ func ToCommitment(allocations []*Allocation, } if auxLeaves.IncomingHtlcLeaves == nil { - auxLeaves.IncomingHtlcLeaves = make(input.AuxTapLeaves) + auxLeaves.IncomingHtlcLeaves = make(input.HtlcAuxLeaves) } auxLeaves.IncomingHtlcLeaves[a.HtlcIndex] = input.HtlcAuxLeaf{ @@ -1189,7 +1194,7 @@ func collectOutputs(a *Allocation, // CreateSecondLevelHtlcPackets creates the virtual packets for the second level // HTLC transaction. -func CreateSecondLevelHtlcPackets(chanState *channeldb.OpenChannel, +func CreateSecondLevelHtlcPackets(chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, htlcAmt btcutil.Amount, keys lnwallet.CommitmentKeyRing, chainParams *address.ChainParams, htlcOutputs []*cmsg.AssetOutput) ([]*tappsbt.VPacket, []*Allocation, @@ -1267,7 +1272,7 @@ func CreateSecondLevelHtlcPackets(chanState *channeldb.OpenChannel, // CreateSecondLevelHtlcTx creates the auxiliary leaf for a successful or timed // out second level HTLC transaction. -func CreateSecondLevelHtlcTx(chanState *channeldb.OpenChannel, +func CreateSecondLevelHtlcTx(chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, htlcAmt btcutil.Amount, keys lnwallet.CommitmentKeyRing, chainParams *address.ChainParams, htlcOutputs []*cmsg.AssetOutput) (input.AuxTapLeaf, error) { diff --git a/tapchannelmsg/records.go b/tapchannelmsg/records.go index 837e7e345..0b750711d 100644 --- a/tapchannelmsg/records.go +++ b/tapchannelmsg/records.go @@ -177,7 +177,7 @@ type AuxLeaves struct { // NewAuxLeaves creates a new AuxLeaves record with the given local, remote, // incoming, and outgoing auxiliary leaves. func NewAuxLeaves(local, remote input.AuxTapLeaf, outgoing, - incoming input.AuxTapLeaves) AuxLeaves { + incoming input.HtlcAuxLeaves) AuxLeaves { leaves := AuxLeaves{ OutgoingHtlcLeaves: tlv.NewRecordT[tlv.TlvType2]( @@ -467,8 +467,8 @@ func (c *Commitment) Bytes() []byte { // Leaves returns the auxiliary leaves that correspond to the commitment. func (c *Commitment) Leaves() lnwallet.CommitAuxLeaves { leaves := lnwallet.CommitAuxLeaves{ - OutgoingHtlcLeaves: make(input.AuxTapLeaves), - IncomingHtlcLeaves: make(input.AuxTapLeaves), + OutgoingHtlcLeaves: make(input.HtlcAuxLeaves), + IncomingHtlcLeaves: make(input.HtlcAuxLeaves), } c.AuxLeaves.Val.LocalAuxLeaf.WhenSome( func(r tlv.RecordT[tlv.TlvType0, TapLeafRecord]) { @@ -1076,9 +1076,7 @@ type HtlcAuxLeafMapRecord struct { // NewHtlcAuxLeafMapRecord creates a new HtlcAuxLeafMapRecord record with the // given HTLC aux leaves. -func NewHtlcAuxLeafMapRecord( - leaves map[input.HtlcIndex]input.HtlcAuxLeaf) HtlcAuxLeafMapRecord { - +func NewHtlcAuxLeafMapRecord(leaves input.HtlcAuxLeaves) HtlcAuxLeafMapRecord { if leaves == nil { return HtlcAuxLeafMapRecord{} } diff --git a/tapchannelmsg/records_test.go b/tapchannelmsg/records_test.go index 7bc7ebada..a4f087eaa 100644 --- a/tapchannelmsg/records_test.go +++ b/tapchannelmsg/records_test.go @@ -127,7 +127,7 @@ func TestAuxLeaves(t *testing.T) { leaves: NewAuxLeaves( lfn.Some(test.RandTapLeaf(nil)), lfn.Some(test.RandTapLeaf(nil)), - input.AuxTapLeaves{ + input.HtlcAuxLeaves{ 0: input.HtlcAuxLeaf{ AuxTapLeaf: lfn.Some( test.RandTapLeaf(nil), @@ -142,7 +142,7 @@ func TestAuxLeaves(t *testing.T) { ), }, }, - input.AuxTapLeaves{ + input.HtlcAuxLeaves{ 0: input.HtlcAuxLeaf{ AuxTapLeaf: lfn.Some( test.RandTapLeaf(nil), @@ -303,7 +303,7 @@ func TestCommitment(t *testing.T) { RemoteAuxLeaf: lfn.Some( test.RandTapLeaf(nil), ), - OutgoingHtlcLeaves: input.AuxTapLeaves{ + OutgoingHtlcLeaves: input.HtlcAuxLeaves{ 0: input.HtlcAuxLeaf{ AuxTapLeaf: randLeaf, }, @@ -313,7 +313,7 @@ func TestCommitment(t *testing.T) { SecondLevelLeaf: randLeaf, }, }, - IncomingHtlcLeaves: input.AuxTapLeaves{ + IncomingHtlcLeaves: input.HtlcAuxLeaves{ 0: input.HtlcAuxLeaf{ AuxTapLeaf: randLeaf, },