diff --git a/go.mod b/go.mod index 1d429a7..447fc83 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.17 // +heroku goVersion go1.17 require ( + github.com/btcsuite/btcd v0.23.1 github.com/getsentry/sentry-go v0.12.0 github.com/go-playground/validator/v10 v10.10.0 github.com/golang-jwt/jwt v3.2.2+incompatible @@ -12,8 +13,8 @@ require ( github.com/kelseyhightower/envconfig v1.4.0 github.com/labstack/echo/v4 v4.7.2 github.com/labstack/gommon v0.3.1 - github.com/lightningnetwork/lnd v0.14.1-beta - github.com/stretchr/testify v1.7.0 + github.com/lightningnetwork/lnd v0.15.0-beta.rc6 + github.com/stretchr/testify v1.7.1 github.com/uptrace/bun v1.0.21 github.com/uptrace/bun/dialect/pgdialect v1.0.21 github.com/uptrace/bun/dialect/sqlitedialect v1.0.21 @@ -32,25 +33,29 @@ require ( github.com/aead/siphash v1.0.1 // indirect github.com/andybalholm/brotli v1.0.3 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/btcsuite/btcd v0.22.0-beta.0.20211005184431-e3449998be39 // indirect + github.com/btcsuite/btcd/btcutil v1.1.1 // indirect + github.com/btcsuite/btcd/btcutil/psbt v1.1.4 // indirect + github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect - github.com/btcsuite/btcutil v1.0.3-0.20210527170813-e2ba6805a890 // indirect - github.com/btcsuite/btcutil/psbt v1.0.3-0.20210527170813-e2ba6805a890 // indirect - github.com/btcsuite/btcwallet v0.13.0 // indirect - github.com/btcsuite/btcwallet/wallet/txauthor v1.1.0 // indirect - github.com/btcsuite/btcwallet/wallet/txrules v1.1.0 // indirect + github.com/btcsuite/btcwallet v0.15.1 // indirect + github.com/btcsuite/btcwallet/wallet/txauthor v1.2.3 // indirect + github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 // indirect github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0 // indirect - github.com/btcsuite/btcwallet/walletdb v1.3.6-0.20210803004036-eebed51155ec // indirect - github.com/btcsuite/btcwallet/wtxmgr v1.3.1-0.20210822222949-9b5a201c344c // indirect + github.com/btcsuite/btcwallet/walletdb v1.4.0 // indirect + github.com/btcsuite/btcwallet/wtxmgr v1.5.0 // indirect github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect + github.com/btcsuite/winsvc v1.0.0 // indirect github.com/cespare/xxhash/v2 v2.1.1 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/decred/dcrd/lru v1.0.0 // indirect github.com/dsnet/compress v0.0.1 // indirect github.com/dustin/go-humanize v1.0.0 // indirect + github.com/dvyukov/go-fuzz v0.0.0-20210602112143-b1f3d6f4ef4e // indirect github.com/fatih/color v1.13.0 // indirect github.com/fergusstrange/embedded-postgres v1.10.0 // indirect github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect @@ -59,6 +64,7 @@ require ( github.com/go-openapi/jsonreference v0.20.0 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/gofrs/uuid v4.2.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -76,12 +82,20 @@ require ( github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect github.com/jackc/pgtype v1.8.1 // indirect github.com/jackc/pgx/v4 v4.13.0 // indirect + github.com/jessevdk/go-flags v1.4.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jonboulle/clockwork v0.2.2 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/jrick/logrotate v1.0.0 // indirect github.com/json-iterator/go v1.1.11 // indirect - github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8 // indirect + github.com/juju/clock v0.0.0-20220203021603-d9deb868a28a // indirect + github.com/juju/collections v0.0.0-20220203020748-febd7cad8a7a // indirect + github.com/juju/errors v0.0.0-20220331221717-b38fca44723b // indirect + github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4 // indirect + github.com/juju/mgo/v2 v2.0.0-20220111072304-f200228f1090 // indirect + github.com/juju/retry v0.0.0-20220204093819-62423bf33287 // indirect + github.com/juju/utils/v3 v3.0.0-20220203023959-c3fbc78a33b0 // indirect + github.com/juju/version/v2 v2.0.0-20220204124744-fc9915e3d935 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kkdai/bstream v1.0.0 // indirect github.com/klauspost/compress v1.13.6 // indirect @@ -89,13 +103,15 @@ require ( github.com/leodido/go-urn v1.2.1 // indirect github.com/lib/pq v1.10.3 // indirect github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect - github.com/lightninglabs/neutrino v0.13.0 // indirect - github.com/lightningnetwork/lightning-onion v1.0.2-0.20210520211913-522b799e65b1 // indirect + github.com/lightninglabs/neutrino v0.14.2 // indirect + github.com/lightningnetwork/lightning-onion v1.0.2-0.20220211021909-bb84a1ccb0c5 // indirect github.com/lightningnetwork/lnd/clock v1.1.0 // indirect - github.com/lightningnetwork/lnd/healthcheck v1.2.0 // indirect - github.com/lightningnetwork/lnd/kvdb v1.2.1 // indirect + github.com/lightningnetwork/lnd/healthcheck v1.2.2 // indirect + github.com/lightningnetwork/lnd/kvdb v1.3.1 // indirect github.com/lightningnetwork/lnd/queue v1.1.0 // indirect github.com/lightningnetwork/lnd/ticker v1.1.0 // indirect + github.com/lightningnetwork/lnd/tlv v1.0.3 // indirect + github.com/lightningnetwork/lnd/tor v1.0.1 // indirect github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.12 // indirect @@ -120,6 +136,7 @@ require ( github.com/soheilhy/cmux v0.1.5 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect github.com/ulikunitz/xz v0.5.10 // indirect @@ -151,6 +168,7 @@ require ( go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.17.0 // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect @@ -177,6 +195,7 @@ require ( require ( github.com/BurntSushi/toml v1.1.0 // indirect github.com/SporkHubr/echo-http-cache v0.0.0-20200706100054-1d7ae9f38029 + github.com/btcsuite/btcd/btcec/v2 v2.2.0 github.com/go-openapi/spec v0.20.5 // indirect github.com/go-openapi/swag v0.21.1 // indirect github.com/gorilla/websocket v1.5.0 @@ -185,7 +204,6 @@ require ( github.com/swaggo/echo-swagger v1.3.0 github.com/swaggo/swag v1.8.1 golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba golang.org/x/tools v0.1.10 // indirect google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0 // indirect diff --git a/go.sum b/go.sum index a07b71d..d2cacc2 100644 --- a/go.sum +++ b/go.sum @@ -33,7 +33,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.schwanenlied.me/yawning/bsaes.git v0.0.0-20180720073208-c0276d75487e/go.mod h1:BWqTsj8PgcPriQJGl7el20J/7TuT1d/hSyFDXMEpoEo= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I= @@ -47,8 +46,6 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e/go.mod h1:Bdzq+51GR4/0DIhaICZEOm+OHvXGwwB2trKZ8B4Y6eQ= -github.com/NebulousLabs/go-upnp v0.0.0-20180202185039-29b680b06c82/go.mod h1:GbuBk21JqF+driLX3XtJYNZjGa45YDoa9IqCTzNSfEc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= @@ -56,7 +53,6 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/SporkHubr/echo-http-cache v0.0.0-20200706100054-1d7ae9f38029 h1:XjAr0qCBlYmF0xb1rAQXg+FENEWQT8CUQd20DQHeAgI= github.com/SporkHubr/echo-http-cache v0.0.0-20200706100054-1d7ae9f38029/go.mod h1:/JdnJQCTSrjBrEmR8UtcAwsCcFMAeq3c25NK9m21YOA= github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= -github.com/Yawning/aez v0.0.0-20180114000226-4dad034d9db2/go.mod h1:9pIqrY6SXNL8vjRQE5Hd/OL5GyK/9MrGUWs87z/eFfk= github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da h1:KjTM2ks9d14ZYCvmHS9iAKVt9AyzRSqNU1qabPih5BY= github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da/go.mod h1:eHEWzANqSiWQsof+nXEI9bUVUyV6F53Fp89EuCh2EAA= github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg= @@ -79,7 +75,6 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.0.3 h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJyXg= @@ -90,52 +85,56 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/btcsuite/btcd v0.0.0-20190629003639-c26ffa870fd8/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta.0.20201208033208-6bd4c64a54fa/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs= -github.com/btcsuite/btcd v0.22.0-beta.0.20210803133449-f5a1fb9965e4/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= -github.com/btcsuite/btcd v0.22.0-beta.0.20211005184431-e3449998be39 h1:o6qacOzpKubr16y0RrE2fBauRZN1rDZ1YsE26ixCgQ0= -github.com/btcsuite/btcd v0.22.0-beta.0.20211005184431-e3449998be39/go.mod h1:3PH+KbvLFfzBTCevQenPiDedjGQGt6aa70dVjJDWGTA= +github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= +github.com/btcsuite/btcd v0.22.0-beta.0.20220204213055-eaf0459ff879/go.mod h1:osu7EoKiL36UThEgzYPqdRaxeo0NU8VoXqgcnwpey0g= +github.com/btcsuite/btcd v0.22.0-beta.0.20220207191057-4dc4ff7963b4/go.mod h1:7alexyj/lHlOtr2PJK7L/+HDJZpcGDn/pAU98r7DY08= +github.com/btcsuite/btcd v0.22.0-beta.0.20220316175102-8d5c75c28923/go.mod h1:taIcYprAW2g6Z9S0gGUxyR+zDwimyDMK5ePOX+iJ2ds= +github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= +github.com/btcsuite/btcd v0.23.1 h1:IB8cVQcC2X5mHbnfirLG5IZnkWYNTPlLZVrxUYSotbE= +github.com/btcsuite/btcd v0.23.1/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= +github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= +github.com/btcsuite/btcd/btcec/v2 v2.1.1/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= +github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= +github.com/btcsuite/btcd/btcutil v1.1.1 h1:hDcDaXiP0uEzR8Biqo2weECKqEw0uHDZ9ixIWevVQqY= +github.com/btcsuite/btcd/btcutil v1.1.1/go.mod h1:nbKlBMNm9FGsdvKvu0essceubPiAcI57pYBNnsLAa34= +github.com/btcsuite/btcd/btcutil/psbt v1.1.4 h1:Edx4AfBn+YPam2KP5AobDitulGp4r1Oibm8oruzkMdI= +github.com/btcsuite/btcd/btcutil/psbt v1.1.4/go.mod h1:9AyU6EQVJ9Iw9zPyNT1lcdHd6cnEZdno5wLu5FY74os= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= 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/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= -github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= -github.com/btcsuite/btcutil v1.0.3-0.20210527170813-e2ba6805a890 h1:9aGy5p7oXRUB4MCTmWm0+jzuh79GpjPIfv1leA5POD4= -github.com/btcsuite/btcutil v1.0.3-0.20210527170813-e2ba6805a890/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= -github.com/btcsuite/btcutil/psbt v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:LVveMu4VaNSkIRTZu2+ut0HDBRuYjqGocxDMNS1KuGQ= -github.com/btcsuite/btcutil/psbt v1.0.3-0.20210527170813-e2ba6805a890 h1:0xUNvvwJ7RjzBs4nCF+YrK28S5P/b4uHkpPxY1ovGY4= -github.com/btcsuite/btcutil/psbt v1.0.3-0.20210527170813-e2ba6805a890/go.mod h1:LVveMu4VaNSkIRTZu2+ut0HDBRuYjqGocxDMNS1KuGQ= -github.com/btcsuite/btcwallet v0.13.0 h1:gtLWwueRm27KQiHJpycybv3uMdK1eo87JexfTfzvEhk= -github.com/btcsuite/btcwallet v0.13.0/go.mod h1:iLN1lG1MW0eREm+SikmPO8AZPz5NglBTEK/ErqkjGpo= -github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0/go.mod h1:VufDts7bd/zs3GV13f/lXc/0lXrPnvxD/NvmpG/FEKU= -github.com/btcsuite/btcwallet/wallet/txauthor v1.1.0 h1:8pO0pvPX1rFRfRiol4oV6kX7dY5y4chPwhfVwUfvwtk= -github.com/btcsuite/btcwallet/wallet/txauthor v1.1.0/go.mod h1:ktYuJyumYtwG+QQ832Q+kqvxWJRAei3Nqs5qhSn4nww= -github.com/btcsuite/btcwallet/wallet/txrules v1.0.0/go.mod h1:UwQE78yCerZ313EXZwEiu3jNAtfXj2n2+c8RWiE/WNA= -github.com/btcsuite/btcwallet/wallet/txrules v1.1.0 h1:Vg8G8zhNVjaCdwJg2QOmLoWn4RTP7K0J9xlwY8CJnLY= -github.com/btcsuite/btcwallet/wallet/txrules v1.1.0/go.mod h1:Zn9UTqpiTH+HOd5BLzSBzULzlOPmcoeyQIA0cp0WbQQ= -github.com/btcsuite/btcwallet/wallet/txsizes v1.0.0/go.mod h1:pauEU8UuMFiThe5PB3EO+gO5kx87Me5NvdQDsTuq6cs= +github.com/btcsuite/btcwallet v0.15.1 h1:SKfh/l2Bgz9sJwHZvfiVbZ8Pl3N/8fFcWWXzsAPz9GU= +github.com/btcsuite/btcwallet v0.15.1/go.mod h1:7OFsQ8ypiRwmr67hE0z98uXgJgXGAihE79jCib9x6ag= +github.com/btcsuite/btcwallet/wallet/txauthor v1.2.3 h1:M2yr5UlULvpqtxUqpMxTME/pA92Z9cpqeyvAFk9lAg0= +github.com/btcsuite/btcwallet/wallet/txauthor v1.2.3/go.mod h1:T2xSiKGpUkSLCh68aF+FMXmKK9mFqNdHl9VaqOr+JjU= +github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 h1:BtEN5Empw62/RVnZ0VcJaVtVlBijnLlJY+dwjAye2Bg= +github.com/btcsuite/btcwallet/wallet/txrules v1.2.0/go.mod h1:AtkqiL7ccKWxuLYtZm8Bu8G6q82w4yIZdgq6riy60z0= github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0 h1:wZnOolEAeNOHzHTnznw/wQv+j35ftCIokNrnOTOU5o8= github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0/go.mod h1:pauEU8UuMFiThe5PB3EO+gO5kx87Me5NvdQDsTuq6cs= -github.com/btcsuite/btcwallet/walletdb v1.3.4/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU= github.com/btcsuite/btcwallet/walletdb v1.3.5/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU= -github.com/btcsuite/btcwallet/walletdb v1.3.6-0.20210803004036-eebed51155ec h1:zcAU3Ij8SmqaE+ITtS76fua2Niq7DRNp46sJRhi8PiI= github.com/btcsuite/btcwallet/walletdb v1.3.6-0.20210803004036-eebed51155ec/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU= -github.com/btcsuite/btcwallet/wtxmgr v1.3.0/go.mod h1:awQsh1n/0ZrEQ+JZgWvHeo153ubzEisf/FyNtwI0dDk= -github.com/btcsuite/btcwallet/wtxmgr v1.3.1-0.20210822222949-9b5a201c344c h1:owWPexGfK4eSK4/Zy+XK2lET5qsnW7FRAc8OCOdD0Fg= -github.com/btcsuite/btcwallet/wtxmgr v1.3.1-0.20210822222949-9b5a201c344c/go.mod h1:UM38ixX8VwJ9qey4umf//0H3ndn5kSImFZ46V54Nd5Q= +github.com/btcsuite/btcwallet/walletdb v1.4.0 h1:/C5JRF+dTuE2CNMCO/or5N8epsrhmSM4710uBQoYPTQ= +github.com/btcsuite/btcwallet/walletdb v1.4.0/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU= +github.com/btcsuite/btcwallet/wtxmgr v1.5.0 h1:WO0KyN4l6H3JWnlFxfGR7r3gDnlGT7W2cL8vl6av4SU= +github.com/btcsuite/btcwallet/wtxmgr v1.5.0/go.mod h1:TQVDhFxseiGtZwEPvLgtfyxuNUDsIdaJdshvWzR0HJ4= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/golangcrypto v0.0.0-20150304025918-53f62d9b43e8/go.mod h1:tYvUd8KLhm/oXvUeSEs2VlLghFjQt9+ZaF9ghH0JNjc= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/goleveldb v1.0.0 h1:Tvd0BfvqX9o823q1j2UZ/epQo09eJh6dTcRp79ilIN4= github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/snappy-go v1.0.0 h1:ZxaA6lo2EpxGddsA8JwWOcxlzRybb444sgmeJQMJGQE= github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= +github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= @@ -186,6 +185,10 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/lru v1.0.0 h1:Kbsb1SFDsIlaupWPwsPp+dkxiBY1frcS07PCPgotKz8= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= @@ -199,6 +202,8 @@ github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5Jflh github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dvyukov/go-fuzz v0.0.0-20210602112143-b1f3d6f4ef4e h1:qTP1telKJHlToHlwPQNmVg4yfMDMHe4Z3SYmzkrvA2M= +github.com/dvyukov/go-fuzz v0.0.0-20210602112143-b1f3d6f4ef4e/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -222,6 +227,8 @@ github.com/frankban/quicktest v1.0.0/go.mod h1:R98jIehRai+d1/3Hv2//jOVCTJhW1VBav github.com/frankban/quicktest v1.2.2 h1:xfmOhhoH5fGPgbEAlhLpJH9p0z/0Qizio9osmvn9IUY= github.com/frankban/quicktest v1.2.2/go.mod h1:Qh/WofXFeiAFII1aEBu529AtJo6Zg2VHscnEsbBnJ20= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs= github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= @@ -243,7 +250,6 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= -github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= @@ -253,7 +259,6 @@ github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXym github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= github.com/go-openapi/spec v0.20.5 h1:skHa8av4VnAtJU5zyAUXrrdK/NDiVX8lchbG+BfcdrE= github.com/go-openapi/spec v0.20.5/go.mod h1:QbfOSIVt3/sac+a1wzmKbbcLXm5NdZnyBZYtCijp43o= -github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU= @@ -274,8 +279,9 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22 github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0= +github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= @@ -350,7 +356,6 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -446,10 +451,8 @@ github.com/jackc/pgx/v4 v4.13.0/go.mod h1:9P4X524sErlaxj0XSGZk7s+LD0eOyu1ZDUrrpz github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v0.0.0-20170405195558-28a68d0c24ad/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jedib0t/go-pretty v4.3.0+incompatible/go.mod h1:XemHduiw8R651AF9Pt4FwCTKeG3oo7hrHJAoznj9nag= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= @@ -471,20 +474,24 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/juju/clock v0.0.0-20190205081909-9c5c9712527c h1:3UvYABOQRhJAApj9MdCN+Ydv841ETSoy6xLzdmmr/9A= -github.com/juju/clock v0.0.0-20190205081909-9c5c9712527c/go.mod h1:nD0vlnrUjcjJhqN5WuCWZyzfd5AHZAC9/ajvbSx69xA= -github.com/juju/errors v0.0.0-20190806202954-0232dcc7464d h1:hJXjZMxj0SWlMoQkzeZDLi2cmeiWKa7y1B8Rg+qaoEc= -github.com/juju/errors v0.0.0-20190806202954-0232dcc7464d/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= -github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8 h1:UUHMLvzt/31azWTN/ifGWef4WUqvXk0iRqdhdy/2uzI= -github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= -github.com/juju/retry v0.0.0-20180821225755-9058e192b216 h1:/eQL7EJQKFHByJe3DeE8Z36yqManj9UY5zppDoQi4FU= -github.com/juju/retry v0.0.0-20180821225755-9058e192b216/go.mod h1:OohPQGsr4pnxwD5YljhQ+TZnuVRYpa5irjugL1Yuif4= -github.com/juju/testing v0.0.0-20190723135506-ce30eb24acd2 h1:Pp8RxiF4rSoXP9SED26WCfNB28/dwTDpPXS8XMJR8rc= -github.com/juju/testing v0.0.0-20190723135506-ce30eb24acd2/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= -github.com/juju/utils v0.0.0-20180820210520-bf9cc5bdd62d h1:irPlN9z5VCe6BTsqVsxheCZH99OFSmqSVyTigW4mEoY= -github.com/juju/utils v0.0.0-20180820210520-bf9cc5bdd62d/go.mod h1:6/KLg8Wz/y2KVGWEpkK9vMNGkOnu4k/cqs8Z1fKjTOk= -github.com/juju/version v0.0.0-20180108022336-b64dbd566305 h1:lQxPJ1URr2fjsKnJRt/BxiIxjLt9IKGvS+0injMHbag= -github.com/juju/version v0.0.0-20180108022336-b64dbd566305/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= +github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= +github.com/juju/clock v0.0.0-20220203021603-d9deb868a28a h1:Az/6CM/P5guGHNy7r6TkOCctv3lDmN3W1uhku7QMupk= +github.com/juju/clock v0.0.0-20220203021603-d9deb868a28a/go.mod h1:GZ/FY8Cqw3KHG6DwRVPUKbSPTAwyrU28xFi5cqZnLsc= +github.com/juju/collections v0.0.0-20220203020748-febd7cad8a7a h1:d7eZO8OS/ZXxdP0uq3E8CdoA1qNFaecAv90UxrxaY2k= +github.com/juju/collections v0.0.0-20220203020748-febd7cad8a7a/go.mod h1:JWeZdyttIEbkR51z2S13+J+aCuHVe0F6meRy+P0YGDo= +github.com/juju/errors v0.0.0-20220331221717-b38fca44723b h1:AxFeSQJfcm2O3ov1wqAkTKYFsnMw2g1B4PkYujfAdkY= +github.com/juju/errors v0.0.0-20220331221717-b38fca44723b/go.mod h1:jMGj9DWF/qbo91ODcfJq6z/RYc3FX3taCBZMCcpI4Ls= +github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4 h1:NO5tuyw++EGLnz56Q8KMyDZRwJwWO8jQnj285J3FOmY= +github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4/go.mod h1:NIXFioti1SmKAlKNuUwbMenNdef59IF52+ZzuOmHYkg= +github.com/juju/mgo/v2 v2.0.0-20220111072304-f200228f1090 h1:zX5GoH3Jp8k1EjUFkApu/YZAYEn0PYQfg/U6IDyNyYs= +github.com/juju/mgo/v2 v2.0.0-20220111072304-f200228f1090/go.mod h1:N614SE0a4e+ih2rg96Vi2PeC3cTpUOWgCTv3Cgk974c= +github.com/juju/retry v0.0.0-20220204093819-62423bf33287 h1:U+7oMWEglXfiikIppNexButZRwKPlzLBGKYSNCXzXf8= +github.com/juju/retry v0.0.0-20220204093819-62423bf33287/go.mod h1:SssN1eYeK3A2qjnFGTiVMbdzGJ2BfluaJblJXvuvgqA= +github.com/juju/testing v0.0.0-20220203020004-a0ff61f03494 h1:XEDzpuZb8Ma7vLja3+5hzUqVTvAqm5Y+ygvnDs5iTMM= +github.com/juju/utils/v3 v3.0.0-20220203023959-c3fbc78a33b0 h1:bn+2Adl1yWqYjm3KSFlFqsvfLg2eq+XNL7GGMYApdVw= +github.com/juju/utils/v3 v3.0.0-20220203023959-c3fbc78a33b0/go.mod h1:8csUcj1VRkfjNIRzBFWzLFCMLwLqsRWvkmhfVAUwbC4= +github.com/juju/version/v2 v2.0.0-20220204124744-fc9915e3d935 h1:6YoyzXVW1XkqN86y2s/rz365Jm7EiAy39v2G5ikzvHU= +github.com/juju/version/v2 v2.0.0-20220204124744-fc9915e3d935/go.mod h1:ZeFjNy+UFEWJDDPdzW7Cm9NeU6dsViGaFYhXzycLQrw= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= @@ -552,32 +559,36 @@ github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg= github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= 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/neutrino v0.12.1/go.mod h1:GlKninWpRBbL7b8G0oQ36/8downfnFwKsr0hbRA6E/E= -github.com/lightninglabs/neutrino v0.13.0 h1:j3PKWEJCwqwMn/qLASz2j0IuCF6AumS9DaM0i0pM/nY= -github.com/lightninglabs/neutrino v0.13.0/go.mod h1:GlKninWpRBbL7b8G0oQ36/8downfnFwKsr0hbRA6E/E= -github.com/lightninglabs/protobuf-hex-display v1.4.3-hex-display/go.mod h1:2oKOBU042GKFHrdbgGiKax4xVrFiZu51lhacUZQ9MnE= -github.com/lightningnetwork/lightning-onion v1.0.2-0.20210520211913-522b799e65b1 h1:h1BsjPzWea790mAXISoiT/qr0JRcixTCDNLmjsDThSw= -github.com/lightningnetwork/lightning-onion v1.0.2-0.20210520211913-522b799e65b1/go.mod h1:rigfi6Af/KqsF7Za0hOgcyq2PNH4AN70AaMRxcJkff4= -github.com/lightningnetwork/lnd v0.14.1-beta h1:v9hOlJ1xYivYQ634Nt71up5QDh8mXVpYh4MXUbbWTRw= -github.com/lightningnetwork/lnd v0.14.1-beta/go.mod h1:o7zDwjZXm/bPP48qjwsqnZvvITyQl+fUv6UVoV4o+J8= -github.com/lightningnetwork/lnd/cert v1.1.0/go.mod h1:3MWXVLLPI0Mg0XETm9fT4N9Vyy/8qQLmaM5589bEggM= +github.com/lightninglabs/neutrino v0.14.2 h1:yrnZUCYMZ5ECtXhgDrzqPq2oX8awoAN2D/cgCewJcCo= +github.com/lightninglabs/neutrino v0.14.2/go.mod h1:OICUeTCn+4Tu27YRJIpWvvqySxx4oH4vgdP33Sw9RDc= +github.com/lightningnetwork/lightning-onion v1.0.2-0.20220211021909-bb84a1ccb0c5 h1:TkKwqFcQTGYoI+VEqyxA8rxpCin8qDaYX0AfVRinT3k= +github.com/lightningnetwork/lightning-onion v1.0.2-0.20220211021909-bb84a1ccb0c5/go.mod h1:7dDx73ApjEZA0kcknI799m2O5kkpfg4/gr7N092ojNo= +github.com/lightningnetwork/lnd v0.15.0-beta.rc6 h1:CY+vmWgfJcdRpDSrklwq+TYFx9JhLMy6CANOPdaKA3o= +github.com/lightningnetwork/lnd v0.15.0-beta.rc6/go.mod h1:Tm7LZrYeR2JQH1gEOKmd0NTCgjJ1Bnujkx4lcz9b5+A= github.com/lightningnetwork/lnd/clock v1.0.1/go.mod h1:KnQudQ6w0IAMZi1SgvecLZQZ43ra2vpDNj7H/aasemg= github.com/lightningnetwork/lnd/clock v1.1.0 h1:/yfVAwtPmdx45aQBoXQImeY7sOIEr7IXlImRMBOZ7GQ= github.com/lightningnetwork/lnd/clock v1.1.0/go.mod h1:KnQudQ6w0IAMZi1SgvecLZQZ43ra2vpDNj7H/aasemg= github.com/lightningnetwork/lnd/healthcheck v1.0.0/go.mod h1:u92p1JGFJNMSkMvztKEwmt1P3TRnLeJBXZ3M85xkU1E= -github.com/lightningnetwork/lnd/healthcheck v1.2.0 h1:00bkNn+hGJM9j3Ht+ulf8YNcSx1HEYSDv5pf4HB1/uQ= -github.com/lightningnetwork/lnd/healthcheck v1.2.0/go.mod h1:WSz3lsUjErJQZ3gb+zW32nM3WIHNiZ3A40GVoaQY5wU= -github.com/lightningnetwork/lnd/kvdb v1.2.1 h1:QevYLPh6bh1SLIvlUaPbrpX/YMKzSPBfmGVvn2i8IlU= -github.com/lightningnetwork/lnd/kvdb v1.2.1/go.mod h1:x+IpsuDynubjokUofavLXroeGfS/WrqUXXTK6vN/gp4= +github.com/lightningnetwork/lnd/healthcheck v1.2.2 h1:im+qcpgSuteqRCGeorT9yqVXuLrS6A7/acYzGgarMS4= +github.com/lightningnetwork/lnd/healthcheck v1.2.2/go.mod h1:IWY0GChlarRbXFkFDdE4WY5POYJabe/7/H1iCZt4ZKs= +github.com/lightningnetwork/lnd/kvdb v1.3.1 h1:gEz3zudNNRrCLEvqRaktYoKwsUblyHX+MKjR0aI3QnM= +github.com/lightningnetwork/lnd/kvdb v1.3.1/go.mod h1:x+IpsuDynubjokUofavLXroeGfS/WrqUXXTK6vN/gp4= github.com/lightningnetwork/lnd/queue v1.0.1/go.mod h1:vaQwexir73flPW43Mrm7JOgJHmcEFBWWSl9HlyASoms= github.com/lightningnetwork/lnd/queue v1.1.0 h1:YpCJjlIvVxN/R7ww2aNiY8ex7U2fucZDLJ67tI3HFx8= github.com/lightningnetwork/lnd/queue v1.1.0/go.mod h1:YTkTVZCxz8tAYreH27EO3s8572ODumWrNdYW2E/YKxg= github.com/lightningnetwork/lnd/ticker v1.0.0/go.mod h1:iaLXJiVgI1sPANIF2qYYUJXjoksPNvGNYowB8aRbpX0= github.com/lightningnetwork/lnd/ticker v1.1.0 h1:ShoBiRP3pIxZHaETndfQ5kEe+S4NdAY1hiX7YbZ4QE4= github.com/lightningnetwork/lnd/ticker v1.1.0/go.mod h1:ubqbSVCn6RlE0LazXuBr7/Zi6QT0uQo++OgIRBxQUrk= +github.com/lightningnetwork/lnd/tlv v1.0.2/go.mod h1:fICAfsqk1IOsC1J7G9IdsWX1EqWRMqEDCNxZJSKr9C4= +github.com/lightningnetwork/lnd/tlv v1.0.3 h1:0xBZcPuXagP6f7TY/RnLNR4igE21ov6qUdTr5NyvhhI= +github.com/lightningnetwork/lnd/tlv v1.0.3/go.mod h1:dzR/aZetBri+ZY/fHbwV06fNn/3UID6htQzbHfREFdo= +github.com/lightningnetwork/lnd/tor v1.0.0/go.mod h1:RDtaAdwfAm+ONuPYwUhNIH1RAvKPv+75lHPOegUcz64= +github.com/lightningnetwork/lnd/tor v1.0.1 h1:A11FrpU0Y//g+fA827W4VnjOeoIvExONdchlLX8wYkA= +github.com/lightningnetwork/lnd/tor v1.0.1/go.mod h1:RDtaAdwfAm+ONuPYwUhNIH1RAvKPv+75lHPOegUcz64= github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 h1:sjOGyegMIhvgfq5oaue6Td+hxZuf3tDC8lAPrFldqFw= github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796/go.mod h1:3p7ZTf9V1sNPI5H8P3NkTFF4LuwMdPl2DodF60qAKqY= github.com/ltcsuite/ltcutil v0.0.0-20181217130922-17f3b04680b6/go.mod h1:8Vg/LTOO0KYa/vlHWJ6XZAevPQThGH5sufO0Hrou/lA= +github.com/lunixbochs/vtclean v0.0.0-20160125035106-4fbf7632a2c6/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -585,6 +596,7 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.0.6/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -596,6 +608,7 @@ github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= @@ -605,7 +618,6 @@ github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOA github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.10 h1:MLn+5bFRlWMGoSRmJour3CL1w/qL96mvipqpwQW/Sfk= github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= @@ -645,15 +657,22 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/nwaples/rardecode v1.1.2 h1:Cj0yZY6T1Zx1R7AhTbyGSALm44/Mmq+BAPc4B/p/d3M= github.com/nwaples/rardecode v1.1.2/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.1-0.20190913142402-a7454ce5950e/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= @@ -762,8 +781,9 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/swaggo/echo-swagger v1.3.0 h1:xxL/4jbCY4Z3udUvqOas+IpTMKbxrKdEKwtS7He0Qhg= github.com/swaggo/echo-swagger v1.3.0/go.mod h1:snY6MlGK+pQAfJNEfX5qaOzt/QuM/WINVxGgQaZVJgg= @@ -772,13 +792,13 @@ github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9J github.com/swaggo/swag v1.7.9/go.mod h1:gZ+TJ2w/Ve1RwQsA2IRoSOTidHz6DX+PIG8GWvbnoLU= github.com/swaggo/swag v1.8.1 h1:JuARzFX1Z1njbCGz+ZytBR15TFJwF2Q7fu8puJHhQYI= github.com/swaggo/swag v1.8.1/go.mod h1:ugemnJsPZm/kRwFUnzBlbHRd0JY9zE1M4F+uy2pAaPQ= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= -github.com/tv42/zbase32 v0.0.0-20160707012821-501572607d02/go.mod h1:tHlrkM198S068ZqfrO6S8HsoJq2bF3ETfTL+kt4tInY= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= @@ -799,7 +819,6 @@ github.com/uptrace/bun/driver/sqliteshim v1.0.21 h1:9cBMi0TosIeomB+N35mXk1Dh8cSK github.com/uptrace/bun/driver/sqliteshim v1.0.21/go.mod h1:xXz8OSqmYnRtxbEktkTjpmEZy7YDroVnX0RVpEs+5zE= github.com/uptrace/bun/extra/bundebug v1.0.21 h1:ILYJLqhx97I9WM+GbCYnF1QjNN63gpI2fvoj04atf8s= github.com/uptrace/bun/extra/bundebug v1.0.21/go.mod h1:n/2QqdhgXrLHDOYqezHmJzBNKf/2NNjE5xMi2fZ38iY= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= @@ -820,6 +839,8 @@ github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= @@ -860,7 +881,6 @@ go.etcd.io/etcd/raft/v3 v3.5.0 h1:kw2TmO3yFTgE+F0mdKkG7xMxkit2duBDa2Hu6D/HMlw= go.etcd.io/etcd/raft/v3 v3.5.0/go.mod h1:UFOHSIvO/nKwd4lhkwabrTD3cqW5yVyYYf/KlD00Szc= go.etcd.io/etcd/server/v3 v3.5.0 h1:jk8D/lwGEDlQU9kZXUFMSANkE22Sg5+mW27ip8xcF9E= go.etcd.io/etcd/server/v3 v3.5.0/go.mod h1:3Ah5ruV+M+7RZr0+Y/5mNLwC+eQlni+mQmOVdCRJoS4= -go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -927,9 +947,7 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= @@ -1017,6 +1035,7 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -1060,7 +1079,6 @@ golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1076,8 +1094,10 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1093,10 +1113,12 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1116,15 +1138,14 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210915083310-ed5796bab164/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= @@ -1313,6 +1334,7 @@ google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+Rur google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1329,16 +1351,15 @@ gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/macaroon-bakery.v2 v2.0.1 h1:0N1TlEdfLP4HXNCg7MQUMp5XwvOoxk+oe9Owr2cpvsc= gopkg.in/macaroon-bakery.v2 v2.0.1/go.mod h1:B4/T17l+ZWGwxFSZQmlBwp25x+og7OkhETfr3S9MbIA= -gopkg.in/macaroon.v2 v2.0.0/go.mod h1:+I6LnTMkm/uV5ew/0nsulNjL16SK4+C8yDmRUzHR17I= gopkg.in/macaroon.v2 v2.1.0 h1:HZcsjBCzq9t0eBPMKqTN/uSN6JOm78ZJ2INbqcBQOUI= gopkg.in/macaroon.v2 v2.1.0/go.mod h1:OUb+TQP/OP0WOerC2Jp/3CwhIKyIa9kQjuc7H24e6/o= gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/integration_tests/auth_test.go b/integration_tests/auth_test.go index ac19437..14af729 100644 --- a/integration_tests/auth_test.go +++ b/integration_tests/auth_test.go @@ -30,7 +30,7 @@ type UserAuthTestSuite struct { } func (suite *UserAuthTestSuite) SetupSuite() { - svc, err := LndHubTestServiceInit(nil) + svc, err := LndHubTestServiceInit(newDefaultMockLND()) if err != nil { log.Fatalf("Error initializing test service: %v", err) } diff --git a/integration_tests/checkpayment_test.go b/integration_tests/checkpayment_test.go index a0d8051..86b9da9 100644 --- a/integration_tests/checkpayment_test.go +++ b/integration_tests/checkpayment_test.go @@ -15,37 +15,28 @@ import ( "github.com/getAlby/lndhub.go/lib/responses" "github.com/getAlby/lndhub.go/lib/service" "github.com/getAlby/lndhub.go/lib/tokens" - "github.com/getAlby/lndhub.go/lnd" "github.com/go-playground/validator/v10" "github.com/labstack/echo/v4" - "github.com/lightningnetwork/lnd/lnrpc" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) type CheckPaymentTestSuite struct { TestSuite - fundingClient *lnd.LNDWrapper service *service.LndhubService + mlnd *MockLND userLogin ExpectedCreateUserResponseBody userToken string invoiceUpdateSubCancelFn context.CancelFunc } func (suite *CheckPaymentTestSuite) SetupSuite() { - lndClient, err := lnd.NewLNDclient(lnd.LNDoptions{ - Address: lnd2RegtestAddress, - MacaroonHex: lnd2RegtestMacaroonHex, - }) - if err != nil { - log.Fatalf("Error setting up funding client: %v", err) - } - suite.fundingClient = lndClient - - svc, err := LndHubTestServiceInit(nil) + mockLND := newDefaultMockLND() + svc, err := LndHubTestServiceInit(mockLND) if err != nil { log.Fatalf("Error initializing test service: %v", err) } + suite.mlnd = mockLND users, userTokens, err := createUsers(svc, 1) if err != nil { log.Fatalf("Error creating test users: %v", err) @@ -85,15 +76,10 @@ func (suite *CheckPaymentTestSuite) TestCheckPaymentNotFound() { func (suite *CheckPaymentTestSuite) TestCheckPaymentProperIsPaidResponse() { // create incoming invoice and fund account invoice := suite.createAddInvoiceReq(1000, "integration test check payments for user", suite.userToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoice.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoice, 0, false, nil) assert.NoError(suite.T(), err) - // wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + time.Sleep(10 * time.Millisecond) // create invoice invoice = suite.createAddInvoiceReq(500, "integration test check payments for user", suite.userToken) // pay invoice, this will create outgoing invoice and settle it diff --git a/integration_tests/create_test.go b/integration_tests/create_test.go index 42202fe..ed214e0 100644 --- a/integration_tests/create_test.go +++ b/integration_tests/create_test.go @@ -25,7 +25,7 @@ type CreateUserTestSuite struct { } func (suite *CreateUserTestSuite) SetupSuite() { - svc, err := LndHubTestServiceInit(nil) + svc, err := LndHubTestServiceInit(newDefaultMockLND()) if err != nil { log.Fatalf("Error initializing test service: %v", err) } diff --git a/integration_tests/getinfo_test.go b/integration_tests/getinfo_test.go index 8df60a7..b6d0719 100644 --- a/integration_tests/getinfo_test.go +++ b/integration_tests/getinfo_test.go @@ -28,7 +28,7 @@ type GetInfoTestSuite struct { } func (suite *GetInfoTestSuite) SetupSuite() { - svc, err := LndHubTestServiceInit(nil) + svc, err := LndHubTestServiceInit(newDefaultMockLND()) if err != nil { log.Fatalf("Error initializing test service: %v", err) } @@ -60,7 +60,7 @@ func (suite *GetInfoTestSuite) TestGetInfoWithDefaultAlias() { assert.Equal(suite.T(), http.StatusOK, rec.Code) assert.NoError(suite.T(), json.NewDecoder(rec.Body).Decode(getInfoResponse)) assert.NotNil(suite.T(), getInfoResponse) - assert.Equal(suite.T(), "alby-simnet-lnd1", getInfoResponse.Alias) + assert.Equal(suite.T(), "Mocky McMockface", getInfoResponse.Alias) } func (suite *GetInfoTestSuite) TestGetInfoWithGivenAlias() { diff --git a/integration_tests/gettxs_test.go b/integration_tests/gettxs_test.go index ead6a8b..a1a6f05 100644 --- a/integration_tests/gettxs_test.go +++ b/integration_tests/gettxs_test.go @@ -15,10 +15,8 @@ import ( "github.com/getAlby/lndhub.go/lib/responses" "github.com/getAlby/lndhub.go/lib/service" "github.com/getAlby/lndhub.go/lib/tokens" - "github.com/getAlby/lndhub.go/lnd" "github.com/go-playground/validator/v10" "github.com/labstack/echo/v4" - "github.com/lightningnetwork/lnd/lnrpc" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) @@ -26,23 +24,15 @@ import ( type GetTxTestSuite struct { TestSuite Service *service.LndhubService - fundingClient *lnd.LNDWrapper userLogin ExpectedCreateUserResponseBody userToken string + mockLND *MockLND invoiceUpdateSubCancelFn context.CancelFunc } func (suite *GetTxTestSuite) SetupSuite() { - lndClient, err := lnd.NewLNDclient(lnd.LNDoptions{ - Address: lnd2RegtestAddress, - MacaroonHex: lnd2RegtestMacaroonHex, - }) - if err != nil { - log.Fatalf("Error setting up funding client: %v", err) - } - suite.fundingClient = lndClient - - svc, err := LndHubTestServiceInit(nil) + mockLND := newDefaultMockLND() + svc, err := LndHubTestServiceInit(mockLND) if err != nil { log.Fatalf("Error initializing test service: %v", err) } @@ -56,6 +46,7 @@ func (suite *GetTxTestSuite) SetupSuite() { suite.invoiceUpdateSubCancelFn = cancel go svc.InvoiceUpdateSubscription(ctx) suite.Service = svc + suite.mockLND = mockLND e := echo.New() e.HTTPErrorHandler = responses.HTTPErrorHandler @@ -88,17 +79,14 @@ func (suite *GetTxTestSuite) TestGetOutgoingInvoices() { assert.Equal(suite.T(), http.StatusOK, rec.Code) assert.NoError(suite.T(), json.NewDecoder(rec.Body).Decode(&responseBody)) assert.Empty(suite.T(), responseBody) - // create incoming invoice and fund account + // fund account invoice := suite.createAddInvoiceReq(1000, "integration test internal payment alice", suite.userToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoice.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mockLND.mockPaidInvoice(invoice, 0, false, nil) assert.NoError(suite.T(), err) - //wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + //wait for a short time to allow the payment to be processed asynchronously + time.Sleep(10 * time.Millisecond) + // create invoice invoice = suite.createAddInvoiceReq(500, "integration test internal payment alice", suite.userToken) // pay invoice, this will create outgoing invoice and settle it diff --git a/integration_tests/incoming_payment_test.go b/integration_tests/incoming_payment_test.go index 66e0727..5cb9588 100644 --- a/integration_tests/incoming_payment_test.go +++ b/integration_tests/incoming_payment_test.go @@ -3,13 +3,10 @@ package integration_tests import ( "bytes" "context" - "crypto/rand" "crypto/sha256" - "encoding/hex" "encoding/json" "fmt" "log" - "math/big" "net/http" "net/http/httptest" "testing" @@ -20,7 +17,6 @@ import ( "github.com/getAlby/lndhub.go/lib/responses" "github.com/getAlby/lndhub.go/lib/service" "github.com/getAlby/lndhub.go/lib/tokens" - "github.com/getAlby/lndhub.go/lnd" "github.com/go-playground/validator/v10" "github.com/labstack/echo/v4" "github.com/labstack/gommon/random" @@ -31,24 +27,17 @@ import ( type IncomingPaymentTestSuite struct { TestSuite - fundingClient *lnd.LNDWrapper service *service.LndhubService + mockLND *MockLND userLogin ExpectedCreateUserResponseBody userToken string invoiceUpdateSubCancelFn context.CancelFunc } func (suite *IncomingPaymentTestSuite) SetupSuite() { - lndClient, err := lnd.NewLNDclient(lnd.LNDoptions{ - Address: lnd2RegtestAddress, - MacaroonHex: lnd2RegtestMacaroonHex, - }) - if err != nil { - log.Fatalf("Error setting up funding client: %v", err) - } - suite.fundingClient = lndClient - - svc, err := LndHubTestServiceInit(nil) + mockLND := newDefaultMockLND() + suite.mockLND = mockLND + svc, err := LndHubTestServiceInit(mockLND) if err != nil { log.Fatalf("Error initializing test service: %v", err) } @@ -93,17 +82,10 @@ func (suite *IncomingPaymentTestSuite) TestIncomingPayment() { assert.Equal(suite.T(), int64(0), balance.BTC.AvailableBalance) fundingSatAmt := 10 invoiceResponse := suite.createAddInvoiceReq(fundingSatAmt, "integration test IncomingPaymentTestSuite", suite.userToken) - //try to pay invoice with external node - // Prepare the LNRPC call - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mockLND.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) - - //wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + //wait a bit for the payment to be processed + time.Sleep(10 * time.Millisecond) //check balance again req = httptest.NewRequest(http.MethodGet, "/balance", &buf) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", suite.userToken)) @@ -132,18 +114,11 @@ func (suite *IncomingPaymentTestSuite) TestIncomingPaymentZeroAmt() { fundingSatAmt := 0 sendSatAmt := 10 invoiceResponse := suite.createAddInvoiceReq(fundingSatAmt, "integration test IncomingPaymentTestSuite", suite.userToken) - //try to pay invoice with external node - // Prepare the LNRPC call - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - Amt: int64(sendSatAmt), - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mockLND.mockPaidInvoice(invoiceResponse, int64(sendSatAmt), false, nil) assert.NoError(suite.T(), err) - //wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + time.Sleep(10 * time.Millisecond) + //check balance again req = httptest.NewRequest(http.MethodGet, "/balance", &buf) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", suite.userToken)) @@ -175,24 +150,16 @@ func (suite *IncomingPaymentTestSuite) TestIncomingPaymentKeysend() { preImage, err := randBytesFromStr(32, random.Hex) assert.NoError(suite.T(), err) pHash.Write(preImage) - destBytes, err := hex.DecodeString(suite.service.IdentityPubkey) - assert.NoError(suite.T(), err) - sendPaymentRequest := lnrpc.SendRequest{ - Dest: destBytes, - Amt: int64(keysendSatAmt), - PaymentHash: pHash.Sum(nil), - DestFeatures: []lnrpc.FeatureBit{lnrpc.FeatureBit_TLV_ONION_REQ}, - DestCustomRecords: map[uint64][]byte{ + err = suite.mockLND.mockPaidInvoice(nil, int64(keysendSatAmt), true, &lnrpc.InvoiceHTLC{ + CustomRecords: map[uint64][]byte{ service.TLV_WALLET_ID: []byte(suite.userLogin.Login), service.KEYSEND_CUSTOM_RECORD: preImage, }, - FeeLimit: nil, - } - _, err = suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + }) assert.NoError(suite.T(), err) //wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + time.Sleep(10 * time.Millisecond) //check balance again req = httptest.NewRequest(http.MethodGet, "/balance", &buf) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", suite.userToken)) @@ -226,19 +193,6 @@ func (suite *IncomingPaymentTestSuite) TestIncomingPaymentKeysend() { assert.Equal(suite.T(), suite.userLogin.Login, string(login)) } -func randBytesFromStr(length int, from string) ([]byte, error) { - b := make([]byte, length) - fromLenBigInt := big.NewInt(int64(len(from))) - for i := range b { - r, err := rand.Int(rand.Reader, fromLenBigInt) - if err != nil { - return nil, err - } - b[i] = from[r.Int64()] - } - return b, nil -} - func TestIncomingPaymentTestSuite(t *testing.T) { suite.Run(t, new(IncomingPaymentTestSuite)) } diff --git a/integration_tests/internal_payment_test.go b/integration_tests/internal_payment_test.go index c0fe93e..c155bef 100644 --- a/integration_tests/internal_payment_test.go +++ b/integration_tests/internal_payment_test.go @@ -17,7 +17,6 @@ import ( "github.com/getAlby/lndhub.go/lib/responses" "github.com/getAlby/lndhub.go/lib/service" "github.com/getAlby/lndhub.go/lib/tokens" - "github.com/getAlby/lndhub.go/lnd" "github.com/go-playground/validator/v10" "github.com/labstack/echo/v4" "github.com/lightningnetwork/lnd/lnrpc" @@ -27,7 +26,8 @@ import ( type PaymentTestSuite struct { TestSuite - fundingClient *lnd.LNDWrapper + mlnd *MockLND + externalLND *MockLND service *service.LndhubService aliceLogin ExpectedCreateUserResponseBody aliceToken string @@ -37,16 +37,14 @@ type PaymentTestSuite struct { } func (suite *PaymentTestSuite) SetupSuite() { - lndClient, err := lnd.NewLNDclient(lnd.LNDoptions{ - Address: lnd3RegtestAddress, - MacaroonHex: lnd3RegtestMacaroonHex, - }) + mlnd := newDefaultMockLND() + suite.mlnd = mlnd + externalLND, err := NewMockLND("1234567890abcdefabcd", 0, make(chan (*lnrpc.Invoice))) if err != nil { - log.Fatalf("Error setting up funding client: %v", err) + log.Fatalf("Error initializing test service: %v", err) } - suite.fundingClient = lndClient - - svc, err := LndHubTestServiceInit(nil) + suite.externalLND = externalLND + svc, err := LndHubTestServiceInit(mlnd) if err != nil { log.Fatalf("Error initializing test service: %v", err) } @@ -95,15 +93,11 @@ func (suite *PaymentTestSuite) TestInternalPayment() { fee := 0 //fund alice account invoiceResponse := suite.createAddInvoiceReq(aliceFundingSats, "integration test internal payment alice", suite.aliceToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) - //wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + //wait a bit for the payment to be processed + time.Sleep(10 * time.Millisecond) //create invoice for bob bobInvoice := suite.createAddInvoiceReq(bobSatRequested, "integration test internal payment bob", suite.bobToken) @@ -144,13 +138,9 @@ func (suite *PaymentTestSuite) TestInternalPaymentFail() { bobSatRequested := 500 // currently fee is 0 for internal payments fee := 0 - //fund alice account invoiceResponse := suite.createAddInvoiceReq(aliceFundingSats, "integration test internal payment alice", suite.aliceToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + + err := suite.mlnd.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) //wait a bit for the callback event to hit @@ -202,13 +192,8 @@ func (suite *PaymentTestSuite) TestInternalPaymentKeysend() { aliceFundingSats := 1000 bobAmt := 100 memo := "integration test internal keysend from alice" - //fund alice account invoiceResponse := suite.createAddInvoiceReq(aliceFundingSats, "integration test internal keysend alice", suite.aliceToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) //wait a bit for the callback event to hit diff --git a/integration_tests/invoice_test.go b/integration_tests/invoice_test.go index 2fe1398..55c0369 100644 --- a/integration_tests/invoice_test.go +++ b/integration_tests/invoice_test.go @@ -23,7 +23,7 @@ type InvoiceTestSuite struct { } func (suite *InvoiceTestSuite) SetupSuite() { - svc, err := LndHubTestServiceInit(nil) + svc, err := LndHubTestServiceInit(newDefaultMockLND()) if err != nil { log.Fatalf("Error initializing test service: %v", err) } diff --git a/integration_tests/keysend_test.go b/integration_tests/keysend_test.go index 150dad0..b93a08a 100644 --- a/integration_tests/keysend_test.go +++ b/integration_tests/keysend_test.go @@ -12,34 +12,27 @@ import ( "github.com/getAlby/lndhub.go/lib/responses" "github.com/getAlby/lndhub.go/lib/service" "github.com/getAlby/lndhub.go/lib/tokens" - "github.com/getAlby/lndhub.go/lnd" "github.com/go-playground/validator/v10" "github.com/labstack/echo/v4" - "github.com/lightningnetwork/lnd/lnrpc" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) type KeySendTestSuite struct { TestSuite - fundingClient *lnd.LNDWrapper service *service.LndhubService + mlnd *MockLND aliceLogin ExpectedCreateUserResponseBody aliceToken string invoiceUpdateSubCancelFn context.CancelFunc } func (suite *KeySendTestSuite) SetupSuite() { - lndClient, err := lnd.NewLNDclient(lnd.LNDoptions{ - Address: lnd2RegtestAddress, - MacaroonHex: lnd2RegtestMacaroonHex, - }) - if err != nil { - log.Fatalf("Error setting up funding client: %v", err) - } - suite.fundingClient = lndClient - - svc, err := LndHubTestServiceInit(nil) + fee := int64(1) + mlnd := newDefaultMockLND() + mlnd.fee = fee + suite.mlnd = mlnd + svc, err := LndHubTestServiceInit(mlnd) if err != nil { log.Fatalf("Error initializing test service: %v", err) } @@ -81,21 +74,15 @@ func (suite *KeySendTestSuite) TearDownSuite() { func (suite *KeySendTestSuite) TestKeysendPayment() { aliceFundingSats := 1000 externalSatRequested := 500 - // 1 sat + 1 ppm - fee := 1 //fund alice account invoiceResponse := suite.createAddInvoiceReq(aliceFundingSats, "integration test external payment alice", suite.aliceToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) //wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + time.Sleep(10 * time.Millisecond) - suite.createKeySendReq(int64(externalSatRequested), "key send test", simnetLnd3PubKey, suite.aliceToken) + suite.createKeySendReq(int64(externalSatRequested), "key send test", "03abcdef123456789a", suite.aliceToken) // check that balance was reduced userId := getUserIdFromToken(suite.aliceToken) @@ -103,7 +90,7 @@ func (suite *KeySendTestSuite) TestKeysendPayment() { if err != nil { fmt.Printf("Error when getting balance %v\n", err.Error()) } - assert.Equal(suite.T(), int64(aliceFundingSats)-int64(externalSatRequested+fee), aliceBalance) + assert.Equal(suite.T(), int64(aliceFundingSats)-int64(externalSatRequested+int(suite.mlnd.fee)), aliceBalance) } func (suite *KeySendTestSuite) TestKeysendPaymentNonExistentDestination() { @@ -111,11 +98,7 @@ func (suite *KeySendTestSuite) TestKeysendPaymentNonExistentDestination() { externalSatRequested := 500 //fund alice account invoiceResponse := suite.createAddInvoiceReq(aliceFundingSats, "integration test external payment alice", suite.aliceToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) //wait a bit for the callback event to hit diff --git a/integration_tests/lnd_mock.go b/integration_tests/lnd_mock.go new file mode 100644 index 0000000..77327ac --- /dev/null +++ b/integration_tests/lnd_mock.go @@ -0,0 +1,264 @@ +package integration_tests + +import ( + "context" + "crypto/rand" + "crypto/sha256" + "encoding/hex" + "log" + "math/big" + "time" + + btcec "github.com/btcsuite/btcd/btcec/v2" + "github.com/btcsuite/btcd/btcec/v2/ecdsa" + "github.com/btcsuite/btcd/chaincfg" + "github.com/getAlby/lndhub.go/lnd" + "github.com/labstack/gommon/random" + "github.com/lightningnetwork/lnd/lnrpc" + "github.com/lightningnetwork/lnd/lnwire" + "github.com/lightningnetwork/lnd/zpay32" + "google.golang.org/grpc" +) + +type MockLND struct { + Sub *MockSubscribeInvoices + fee int64 + privKey *btcec.PrivateKey + pubKey *btcec.PublicKey + addIndexCounter uint64 +} + +func NewMockLND(privkey string, fee int64, invoiceChan chan (*lnrpc.Invoice)) (*MockLND, error) { + privKeyBytes, err := hex.DecodeString(privkey) + if err != nil { + return nil, err + } + privKey, pubKey := btcec.PrivKeyFromBytes(privKeyBytes) + return &MockLND{ + Sub: &MockSubscribeInvoices{ + invoiceChan: invoiceChan, + }, + fee: fee, + privKey: privKey, + pubKey: pubKey, + addIndexCounter: 0, + }, nil +} + +func (mlnd *MockLND) signMsg(msg []byte) ([]byte, error) { + hash := sha256.Sum256(msg) + return ecdsa.SignCompact(mlnd.privKey, hash[:], true) +} + +type MockSubscribeInvoices struct { + invoiceChan chan (*lnrpc.Invoice) +} + +func (mockSub *MockSubscribeInvoices) Recv() (*lnrpc.Invoice, error) { + inv := <-mockSub.invoiceChan + return inv, nil +} + +func (mlnd *MockLND) ListChannels(ctx context.Context, req *lnrpc.ListChannelsRequest, options ...grpc.CallOption) (*lnrpc.ListChannelsResponse, error) { + return &lnrpc.ListChannelsResponse{ + Channels: []*lnrpc.Channel{}, + }, nil +} + +func (mlnd *MockLND) SendPaymentSync(ctx context.Context, req *lnrpc.SendRequest, options ...grpc.CallOption) (*lnrpc.SendResponse, error) { + return &lnrpc.SendResponse{ + PaymentError: "", + PaymentPreimage: []byte("preimage"), + PaymentRoute: &lnrpc.Route{ + TotalTimeLock: 0, + TotalFees: mlnd.fee, + TotalAmt: req.Amt + mlnd.fee, + Hops: []*lnrpc.Hop{}, + TotalFeesMsat: 1000 * mlnd.fee, + TotalAmtMsat: 1000 * (req.Amt + mlnd.fee), + }, + PaymentHash: req.PaymentHash, + }, nil +} + +func (mlnd *MockLND) AddInvoice(ctx context.Context, req *lnrpc.Invoice, options ...grpc.CallOption) (*lnrpc.AddInvoiceResponse, error) { + pHash := sha256.New() + pHash.Write(req.RPreimage) + pHash.Sum(nil) + msat := lnwire.MilliSatoshi(1000 * req.Value) + invoice := &zpay32.Invoice{ + Net: &chaincfg.RegressionNetParams, + MilliSat: &msat, + Timestamp: time.Now(), + PaymentHash: &[32]byte{}, + PaymentAddr: &[32]byte{}, + Features: &lnwire.FeatureVector{ + RawFeatureVector: &lnwire.RawFeatureVector{}, + }, + FallbackAddr: nil, + } + copy(invoice.PaymentHash[:], pHash.Sum(nil)) + copy(invoice.PaymentAddr[:], req.PaymentAddr) + if len(req.DescriptionHash) != 0 { + invoice.DescriptionHash = &[32]byte{} + copy(req.DescriptionHash, invoice.DescriptionHash[:]) + } + if req.Memo != "" { + invoice.Description = &req.Memo + } + pr, err := invoice.Encode(zpay32.MessageSigner{ + SignCompact: mlnd.signMsg, + }) + if err != nil { + return nil, err + } + mlnd.addIndexCounter += 1 + return &lnrpc.AddInvoiceResponse{ + RHash: invoice.PaymentHash[:], + PaymentRequest: pr, + AddIndex: mlnd.addIndexCounter, + }, nil +} + +func (mlnd *MockLND) mockPaidInvoice(added *ExpectedAddInvoiceResponseBody, amtPaid int64, keysend bool, htlc *lnrpc.InvoiceHTLC) error { + var incoming *lnrpc.Invoice + if !keysend { + rhash, err := hex.DecodeString(added.RHash) + if err != nil { + return err + } + inv, err := mlnd.DecodeBolt11(context.Background(), added.PayReq) + if err != nil { + return err + } + incoming = &lnrpc.Invoice{ + Memo: inv.Description, + RPreimage: []byte("123preimage"), + RHash: rhash, + Value: inv.NumSatoshis, + ValueMsat: inv.NumMsat, + Settled: true, + CreationDate: time.Now().Unix(), + SettleDate: time.Now().Unix(), + PaymentRequest: added.PayReq, + DescriptionHash: []byte(inv.DescriptionHash), + FallbackAddr: inv.FallbackAddr, + CltvExpiry: uint64(inv.CltvExpiry), + AmtPaid: inv.NumSatoshis, + AmtPaidSat: inv.NumSatoshis, + AmtPaidMsat: inv.NumMsat, + State: lnrpc.Invoice_SETTLED, + Htlcs: []*lnrpc.InvoiceHTLC{}, + IsKeysend: keysend, + } + } else { + preimage, err := makePreimageHex() + if err != nil { + return err + } + pHash := sha256.New() + pHash.Write(preimage) + incoming = &lnrpc.Invoice{ + Memo: "", + RPreimage: preimage, + RHash: pHash.Sum(nil), + Value: amtPaid, + ValueMsat: 1000 * amtPaid, + Settled: true, + CreationDate: time.Now().Unix(), + SettleDate: time.Now().Unix(), + PaymentRequest: "", + AmtPaid: amtPaid, + AmtPaidSat: amtPaid, + AmtPaidMsat: 1000 * amtPaid, + State: lnrpc.Invoice_SETTLED, + Htlcs: []*lnrpc.InvoiceHTLC{htlc}, + IsKeysend: keysend, + } + } + + if amtPaid != 0 { + incoming.AmtPaidSat = amtPaid + incoming.AmtPaidMsat = 1000 * amtPaid + } + mlnd.Sub.invoiceChan <- incoming + return nil +} + +func (mlnd *MockLND) SubscribeInvoices(ctx context.Context, req *lnrpc.InvoiceSubscription, options ...grpc.CallOption) (lnd.SubscribeInvoicesWrapper, error) { + return mlnd.Sub, nil +} + +func (mlnd *MockLND) GetInfo(ctx context.Context, req *lnrpc.GetInfoRequest, options ...grpc.CallOption) (*lnrpc.GetInfoResponse, error) { + + return &lnrpc.GetInfoResponse{ + Version: "v1.0.0", + CommitHash: "abc123", + IdentityPubkey: hex.EncodeToString(mlnd.pubKey.SerializeCompressed()), + Alias: "Mocky McMockface", + Color: "", + NumPendingChannels: 1, + NumActiveChannels: 10, + NumInactiveChannels: 3, + NumPeers: 10, + BlockHeight: 1000, + BlockHash: "hashhashash", + BestHeaderTimestamp: 123456, + SyncedToChain: true, + SyncedToGraph: true, + Testnet: false, + Chains: []*lnrpc.Chain{{ + Chain: "BTC", + Network: "regtest", + }}, + Uris: []string{"https://mocky.mcmockface.com"}, + Features: map[uint32]*lnrpc.Feature{}, + }, nil +} + +func (mlnd *MockLND) DecodeBolt11(ctx context.Context, bolt11 string, options ...grpc.CallOption) (*lnrpc.PayReq, error) { + inv, err := zpay32.Decode(bolt11, &chaincfg.RegressionNetParams) + if err != nil { + return nil, err + } + result := &lnrpc.PayReq{ + Destination: hex.EncodeToString(inv.Destination.SerializeCompressed()), + PaymentHash: string(inv.PaymentHash[:]), + NumSatoshis: int64(*inv.MilliSat) / 1000, + Timestamp: inv.Timestamp.Unix(), + Expiry: int64(inv.Expiry()), + Description: *inv.Description, + CltvExpiry: int64(inv.MinFinalCLTVExpiry()), + RouteHints: []*lnrpc.RouteHint{}, + PaymentAddr: []byte{}, + NumMsat: int64(*inv.MilliSat), + Features: map[uint32]*lnrpc.Feature{}, + } + if inv.DescriptionHash != nil { + result.DescriptionHash = string(inv.DescriptionHash[:]) + } + return result, nil +} +func makePreimageHex() ([]byte, error) { + return randBytesFromStr(32, random.Hex) +} +func randBytesFromStr(length int, from string) ([]byte, error) { + b := make([]byte, length) + fromLenBigInt := big.NewInt(int64(len(from))) + for i := range b { + r, err := rand.Int(rand.Reader, fromLenBigInt) + if err != nil { + return nil, err + } + b[i] = from[r.Int64()] + } + return b, nil +} + +func newDefaultMockLND() *MockLND { + mockLND, err := NewMockLND("1234567890abcdef", 0, make(chan (*lnrpc.Invoice))) + if err != nil { + log.Fatalf("Error initializing test service: %v", err) + } + return mockLND +} diff --git a/integration_tests/lnd-mock.go b/integration_tests/lnd_mock_async.go similarity index 72% rename from integration_tests/lnd-mock.go rename to integration_tests/lnd_mock_async.go index ee2cb24..fc49b3c 100644 --- a/integration_tests/lnd-mock.go +++ b/integration_tests/lnd_mock_async.go @@ -12,17 +12,12 @@ import ( const SendPaymentMockError = "mocked send payment error" type LNDMockWrapper struct { - *lnd.LNDWrapper + lnd.LightningClientWrapper } -func NewLNDMockWrapper(lndOptions lnd.LNDoptions) (result *LNDMockWrapper, err error) { - lnd, err := lnd.NewLNDclient(lndOptions) - if err != nil { - return nil, err - } - +func NewLNDMockWrapper(lnd lnd.LightningClientWrapper) (result *LNDMockWrapper, err error) { return &LNDMockWrapper{ - LNDWrapper: lnd, + lnd, }, nil } @@ -35,17 +30,12 @@ func (wrapper *LNDMockWrapper) SendPaymentSync(ctx context.Context, req *lnrpc.S var errorMessageChannel = make(chan string, 1) type LNDMockWrapperAsync struct { - *lnd.LNDWrapper + lnd.LightningClientWrapper } -func NewLNDMockWrapperAsync(lndOptions lnd.LNDoptions) (result *LNDMockWrapperAsync, err error) { - lnd, err := lnd.NewLNDclient(lndOptions) - if err != nil { - return nil, err - } - +func NewLNDMockWrapperAsync(lnd lnd.LightningClientWrapper) (result *LNDMockWrapperAsync, err error) { return &LNDMockWrapperAsync{ - LNDWrapper: lnd, + lnd, }, nil } diff --git a/integration_tests/outgoing_payment_test.go b/integration_tests/outgoing_payment_test.go index bbc98c8..61afe51 100644 --- a/integration_tests/outgoing_payment_test.go +++ b/integration_tests/outgoing_payment_test.go @@ -17,25 +17,21 @@ func (suite *PaymentTestSuite) TestOutGoingPayment() { aliceFundingSats := 1000 externalSatRequested := 500 // 1 sat + 1 ppm - fee := 1 + suite.mlnd.fee = 1 //fund alice account invoiceResponse := suite.createAddInvoiceReq(aliceFundingSats, "integration test external payment alice", suite.aliceToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) //wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + time.Sleep(10 * time.Millisecond) //create external invoice externalInvoice := lnrpc.Invoice{ Memo: "integration tests: external pay from alice", Value: int64(externalSatRequested), } - invoice, err := suite.fundingClient.AddInvoice(context.Background(), &externalInvoice) + invoice, err := suite.externalLND.AddInvoice(context.Background(), &externalInvoice) assert.NoError(suite.T(), err) //pay external from alice payResponse := suite.createPayInvoiceReq(&ExpectedPayInvoiceRequestBody{ @@ -49,7 +45,7 @@ func (suite *PaymentTestSuite) TestOutGoingPayment() { if err != nil { fmt.Printf("Error when getting balance %v\n", err.Error()) } - assert.Equal(suite.T(), int64(aliceFundingSats)-int64(externalSatRequested+fee), aliceBalance) + assert.Equal(suite.T(), int64(aliceFundingSats)-int64(externalSatRequested+int(suite.mlnd.fee)), aliceBalance) // check that no additional transaction entry was created transactonEntries, err := suite.service.TransactionEntriesFor(context.Background(), userId) @@ -81,7 +77,7 @@ func (suite *PaymentTestSuite) TestOutGoingPayment() { assert.Equal(suite.T(), int64(0), transactonEntries[1].ParentID) assert.Equal(suite.T(), outgoingInvoices[0].ID, transactonEntries[1].InvoiceID) - assert.Equal(suite.T(), int64(fee), transactonEntries[2].Amount) + assert.Equal(suite.T(), int64(suite.mlnd.fee), transactonEntries[2].Amount) assert.Equal(suite.T(), feeAccount.ID, transactonEntries[2].CreditAccountID) assert.Equal(suite.T(), currentAccount.ID, transactonEntries[2].DebitAccountID) assert.Equal(suite.T(), outgoingInvoices[0].ID, transactonEntries[2].InvoiceID) @@ -98,7 +94,7 @@ func (suite *PaymentTestSuite) TestOutGoingPayment() { responseBody := &[]ExpectedOutgoingInvoice{} assert.Equal(suite.T(), http.StatusOK, rec.Code) assert.NoError(suite.T(), json.NewDecoder(rec.Body).Decode(&responseBody)) - assert.Equal(suite.T(), int64(fee), (*responseBody)[0].Fee) + assert.Equal(suite.T(), int64(suite.mlnd.fee), (*responseBody)[0].Fee) } func (suite *PaymentTestSuite) TestOutGoingPaymentWithNegativeBalance() { @@ -106,25 +102,20 @@ func (suite *PaymentTestSuite) TestOutGoingPaymentWithNegativeBalance() { aliceFundingSats := 1000 externalSatRequested := 1000 // 1 sat + 1 ppm - fee := 1 + suite.mlnd.fee = 1 //fund alice account invoiceResponse := suite.createAddInvoiceReq(aliceFundingSats, "integration test external payment alice", suite.aliceToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) //wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + time.Sleep(10 * time.Millisecond) - //create external invoice externalInvoice := lnrpc.Invoice{ Memo: "integration tests: external pay from alice", Value: int64(externalSatRequested), } - invoice, err := suite.fundingClient.AddInvoice(context.Background(), &externalInvoice) + invoice, err := suite.externalLND.AddInvoice(context.Background(), &externalInvoice) assert.NoError(suite.T(), err) //pay external from alice payResponse := suite.createPayInvoiceReq(&ExpectedPayInvoiceRequestBody{ @@ -139,7 +130,7 @@ func (suite *PaymentTestSuite) TestOutGoingPaymentWithNegativeBalance() { if err != nil { fmt.Printf("Error when getting balance %v\n", err.Error()) } - assert.Equal(suite.T(), int64(aliceFundingSats)-int64(externalSatRequested+fee), aliceBalance) + assert.Equal(suite.T(), int64(aliceFundingSats)-(int64(externalSatRequested)+suite.mlnd.fee), aliceBalance) assert.Equal(suite.T(), int64(-1), aliceBalance) // check that no additional transaction entry was created @@ -172,7 +163,7 @@ func (suite *PaymentTestSuite) TestOutGoingPaymentWithNegativeBalance() { assert.Equal(suite.T(), int64(0), transactonEntries[1].ParentID) assert.Equal(suite.T(), outgoingInvoices[0].ID, transactonEntries[1].InvoiceID) - assert.Equal(suite.T(), int64(fee), transactonEntries[2].Amount) + assert.Equal(suite.T(), int64(suite.mlnd.fee), transactonEntries[2].Amount) assert.Equal(suite.T(), feeAccount.ID, transactonEntries[2].CreditAccountID) assert.Equal(suite.T(), currentAccount.ID, transactonEntries[2].DebitAccountID) assert.Equal(suite.T(), outgoingInvoices[0].ID, transactonEntries[2].InvoiceID) @@ -186,22 +177,18 @@ func (suite *PaymentTestSuite) TestZeroAmountInvoice() { amtToPay := 1000 //fund alice account invoiceResponse := suite.createAddInvoiceReq(aliceFundingSats, "integration test zero amount payment alice", suite.aliceToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) //wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + time.Sleep(10 * time.Millisecond) //create external invoice externalInvoice := lnrpc.Invoice{ Memo: "integration tests: zero amount pay from alice", Value: 0, } - invoice, err := suite.fundingClient.AddInvoice(context.Background(), &externalInvoice) + invoice, err := suite.externalLND.AddInvoice(context.Background(), &externalInvoice) assert.NoError(suite.T(), err) //pay external from alice payResponse := suite.createPayInvoiceReq(&ExpectedPayInvoiceRequestBody{ diff --git a/integration_tests/payment_failure_async_test.go b/integration_tests/payment_failure_async_test.go index d88a825..7f29ae8 100644 --- a/integration_tests/payment_failure_async_test.go +++ b/integration_tests/payment_failure_async_test.go @@ -13,7 +13,6 @@ import ( "github.com/getAlby/lndhub.go/lib/responses" "github.com/getAlby/lndhub.go/lib/service" "github.com/getAlby/lndhub.go/lib/tokens" - "github.com/getAlby/lndhub.go/lnd" "github.com/go-playground/validator/v10" "github.com/labstack/echo/v4" "github.com/lightningnetwork/lnd/lnrpc" @@ -23,7 +22,8 @@ import ( type PaymentTestAsyncErrorsSuite struct { TestSuite - fundingClient *lnd.LNDWrapper + mlnd *MockLND + externalLND *MockLND service *service.LndhubService userLogin ExpectedCreateUserResponseBody userToken string @@ -32,25 +32,19 @@ type PaymentTestAsyncErrorsSuite struct { } func (suite *PaymentTestAsyncErrorsSuite) SetupSuite() { - // use real client for funding only - fundingClient, err := lnd.NewLNDclient(lnd.LNDoptions{ - Address: lnd2RegtestAddress, - MacaroonHex: lnd2RegtestMacaroonHex, - }) + mlnd := newDefaultMockLND() + externalLND, err := NewMockLND("1234567890abcdefabcd", 0, make(chan (*lnrpc.Invoice))) if err != nil { - log.Fatalf("Error setting up funding client: %v", err) + log.Fatalf("Error initializing test service: %v", err) } - + suite.externalLND = externalLND + suite.mlnd = mlnd // inject fake lnd client with failing send payment sync into service - lndClient, err := NewLNDMockWrapperAsync(lnd.LNDoptions{ - Address: lnd1RegtestAddress, - MacaroonHex: lnd1RegtestMacaroonHex, - }) + lndClient, err := NewLNDMockWrapperAsync(mlnd) suite.serviceClient = lndClient if err != nil { log.Fatalf("Error setting up test client: %v", err) } - suite.fundingClient = fundingClient svc, err := LndHubTestServiceInit(lndClient) if err != nil { @@ -86,22 +80,18 @@ func (suite *PaymentTestAsyncErrorsSuite) TestExternalAsyncFailingInvoice() { externalSatRequested := 500 // fund user account invoiceResponse := suite.createAddInvoiceReq(userFundingSats, "integration test external payment user", suite.userToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) // wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + time.Sleep(10 * time.Millisecond) // create external invoice externalInvoice := lnrpc.Invoice{ Memo: "integration tests: external pay from user", Value: int64(externalSatRequested), } - invoice, err := suite.fundingClient.AddInvoice(context.Background(), &externalInvoice) + invoice, err := suite.externalLND.AddInvoice(context.Background(), &externalInvoice) assert.NoError(suite.T(), err) // pay external from user, req will be canceled after 2 sec go suite.createPayInvoiceReqWithCancel(invoice.PaymentRequest, suite.userToken) diff --git a/integration_tests/payment_failure_test.go b/integration_tests/payment_failure_test.go index c66734c..4ead195 100644 --- a/integration_tests/payment_failure_test.go +++ b/integration_tests/payment_failure_test.go @@ -13,7 +13,6 @@ import ( "github.com/getAlby/lndhub.go/lib/responses" "github.com/getAlby/lndhub.go/lib/service" "github.com/getAlby/lndhub.go/lib/tokens" - "github.com/getAlby/lndhub.go/lnd" "github.com/go-playground/validator/v10" "github.com/labstack/echo/v4" "github.com/lightningnetwork/lnd/lnrpc" @@ -23,32 +22,27 @@ import ( type PaymentTestErrorsSuite struct { TestSuite - fundingClient *lnd.LNDWrapper service *service.LndhubService + mlnd *MockLND + externalLND *MockLND userLogin ExpectedCreateUserResponseBody userToken string invoiceUpdateSubCancelFn context.CancelFunc } func (suite *PaymentTestErrorsSuite) SetupSuite() { - // use real client for funding only - fundingClient, err := lnd.NewLNDclient(lnd.LNDoptions{ - Address: lnd2RegtestAddress, - MacaroonHex: lnd2RegtestMacaroonHex, - }) + mlnd := newDefaultMockLND() + externalLND, err := NewMockLND("1234567890abcdefabcd", 0, make(chan (*lnrpc.Invoice))) if err != nil { - log.Fatalf("Error setting up funding client: %v", err) + log.Fatalf("Error initializing test service: %v", err) } - // inject fake lnd client with failing send payment sync into service - lndClient, err := NewLNDMockWrapper(lnd.LNDoptions{ - Address: lnd1RegtestAddress, - MacaroonHex: lnd1RegtestMacaroonHex, - }) + lndClient, err := NewLNDMockWrapper(mlnd) + suite.mlnd = mlnd + suite.externalLND = externalLND if err != nil { log.Fatalf("Error setting up test client: %v", err) } - suite.fundingClient = fundingClient svc, err := LndHubTestServiceInit(lndClient) if err != nil { @@ -84,22 +78,18 @@ func (suite *PaymentTestErrorsSuite) TestExternalFailingInvoice() { externalSatRequested := 500 //fund user account invoiceResponse := suite.createAddInvoiceReq(userFundingSats, "integration test external payment user", suite.userToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoiceResponse.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoiceResponse, 0, false, nil) assert.NoError(suite.T(), err) //wait a bit for the callback event to hit - time.Sleep(100 * time.Millisecond) + time.Sleep(10 * time.Millisecond) //create external invoice externalInvoice := lnrpc.Invoice{ Memo: "integration tests: external pay from user", Value: int64(externalSatRequested), } - invoice, err := suite.fundingClient.AddInvoice(context.Background(), &externalInvoice) + invoice, err := suite.externalLND.AddInvoice(context.Background(), &externalInvoice) assert.NoError(suite.T(), err) //pay external from user, mock will fail immediately _ = suite.createPayInvoiceReqError(invoice.PaymentRequest, suite.userToken) diff --git a/integration_tests/subscription_start_test.go b/integration_tests/subscription_start_test.go index d339a67..2cde79f 100644 --- a/integration_tests/subscription_start_test.go +++ b/integration_tests/subscription_start_test.go @@ -25,10 +25,9 @@ import ( type SubscriptionStartTestSuite struct { TestSuite - service *service.LndhubService - userLogin ExpectedCreateUserResponseBody - userToken string - invoiceUpdateSubCancelFn context.CancelFunc + service *service.LndhubService + userLogin ExpectedCreateUserResponseBody + userToken string } func (suite *SubscriptionStartTestSuite) TearDownSuite() { @@ -39,7 +38,7 @@ func TestSubscriptionStartTestSuite(t *testing.T) { suite.Run(t, new(SubscriptionStartTestSuite)) } func (suite *SubscriptionStartTestSuite) SetupSuite() { - svc, err := LndHubTestServiceInit(nil) + svc, err := LndHubTestServiceInit(newDefaultMockLND()) if err != nil { log.Fatalf("Error initializing test service: %v", err) } diff --git a/integration_tests/util.go b/integration_tests/util.go index b28b835..096fe1a 100644 --- a/integration_tests/util.go +++ b/integration_tests/util.go @@ -23,18 +23,24 @@ import ( "github.com/uptrace/bun/migrate" ) +//not used anymore +// const ( +// lnd1RegtestAddress = "rpc.lnd1.regtest.getalby.com:443" +// lnd1RegtestMacaroonHex = "0201036c6e6402f801030a10e2133a1cac2c5b4d56e44e32dc64c8551201301a160a0761646472657373120472656164120577726974651a130a04696e666f120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a210a086d616361726f6f6e120867656e6572617465120472656164120577726974651a160a076d657373616765120472656164120577726974651a170a086f6666636861696e120472656164120577726974651a160a076f6e636861696e120472656164120577726974651a140a057065657273120472656164120577726974651a180a067369676e6572120867656e657261746512047265616400000620c4f9783e0873fa50a2091806f5ebb919c5dc432e33800b401463ada6485df0ed" +// lnd2RegtestAddress = "rpc.lnd2.regtest.getalby.com:443" +// lnd2RegtestMacaroonHex = "0201036C6E6402F801030A101782922F4358E80655920FC7A7C3E9291201301A160A0761646472657373120472656164120577726974651A130A04696E666F120472656164120577726974651A170A08696E766F69636573120472656164120577726974651A210A086D616361726F6F6E120867656E6572617465120472656164120577726974651A160A076D657373616765120472656164120577726974651A170A086F6666636861696E120472656164120577726974651A160A076F6E636861696E120472656164120577726974651A140A057065657273120472656164120577726974651A180A067369676E6572120867656E657261746512047265616400000620628FFB2938C8540DD3AA5E578D9B43456835FAA176E175FFD4F9FBAE540E3BE9" +// // Use lnd3 for a funding client when testing out fee handling for payments done by lnd-1, since lnd3 doesn't have a direct channel to lnd1. +// // This will cause payment to be routed through lnd2, which will charge a fee (lnd default fee 1 sat base + 1 ppm). +// lnd3RegtestAddress = "rpc.lnd3.regtest.getalby.com:443" +// lnd3RegtestMacaroonHex = "0201036c6e6402f801030a102a5aa69a5efdf4b4a55a5304b164641f1201301a160a0761646472657373120472656164120577726974651a130a04696e666f120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a210a086d616361726f6f6e120867656e6572617465120472656164120577726974651a160a076d657373616765120472656164120577726974651a170a086f6666636861696e120472656164120577726974651a160a076f6e636861696e120472656164120577726974651a140a057065657273120472656164120577726974651a180a067369676e6572120867656e657261746512047265616400000620defbb5a809262297fd661a9ab6d3deb4b7acca4f1309c79addb952f0dc2d8c82" +// simnetLnd1PubKey = "0242898f86064c2fd72de22059c947a83ba23e9d97aedeae7b6dba647123f1d71b" +// simnetLnd2PubKey = "025c1d5d1b4c983cc6350fc2d756fbb59b4dc365e45e87f8e3afe07e24013e8220" +// simnetLnd3PubKey = "03c7092d076f799ab18806743634b4c9bb34e351bdebc91d5b35963f3dc63ec5aa" +// ) + const ( - lnd1RegtestAddress = "rpc.lnd1.regtest.getalby.com:443" - lnd1RegtestMacaroonHex = "0201036c6e6402f801030a10e2133a1cac2c5b4d56e44e32dc64c8551201301a160a0761646472657373120472656164120577726974651a130a04696e666f120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a210a086d616361726f6f6e120867656e6572617465120472656164120577726974651a160a076d657373616765120472656164120577726974651a170a086f6666636861696e120472656164120577726974651a160a076f6e636861696e120472656164120577726974651a140a057065657273120472656164120577726974651a180a067369676e6572120867656e657261746512047265616400000620c4f9783e0873fa50a2091806f5ebb919c5dc432e33800b401463ada6485df0ed" - lnd2RegtestAddress = "rpc.lnd2.regtest.getalby.com:443" - lnd2RegtestMacaroonHex = "0201036C6E6402F801030A101782922F4358E80655920FC7A7C3E9291201301A160A0761646472657373120472656164120577726974651A130A04696E666F120472656164120577726974651A170A08696E766F69636573120472656164120577726974651A210A086D616361726F6F6E120867656E6572617465120472656164120577726974651A160A076D657373616765120472656164120577726974651A170A086F6666636861696E120472656164120577726974651A160A076F6E636861696E120472656164120577726974651A140A057065657273120472656164120577726974651A180A067369676E6572120867656E657261746512047265616400000620628FFB2938C8540DD3AA5E578D9B43456835FAA176E175FFD4F9FBAE540E3BE9" - // Use lnd3 for a funding client when testing out fee handling for payments done by lnd-1, since lnd3 doesn't have a direct channel to lnd1. - // This will cause payment to be routed through lnd2, which will charge a fee (lnd default fee 1 sat base + 1 ppm). - lnd3RegtestAddress = "rpc.lnd3.regtest.getalby.com:443" - lnd3RegtestMacaroonHex = "0201036c6e6402f801030a102a5aa69a5efdf4b4a55a5304b164641f1201301a160a0761646472657373120472656164120577726974651a130a04696e666f120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a210a086d616361726f6f6e120867656e6572617465120472656164120577726974651a160a076d657373616765120472656164120577726974651a170a086f6666636861696e120472656164120577726974651a160a076f6e636861696e120472656164120577726974651a140a057065657273120472656164120577726974651a180a067369676e6572120867656e657261746512047265616400000620defbb5a809262297fd661a9ab6d3deb4b7acca4f1309c79addb952f0dc2d8c82" - simnetLnd1PubKey = "0242898f86064c2fd72de22059c947a83ba23e9d97aedeae7b6dba647123f1d71b" - simnetLnd2PubKey = "025c1d5d1b4c983cc6350fc2d756fbb59b4dc365e45e87f8e3afe07e24013e8220" - simnetLnd3PubKey = "03c7092d076f799ab18806743634b4c9bb34e351bdebc91d5b35963f3dc63ec5aa" + mockLNDAddress = "mock.lnd.local" + mockLNDMacaroonHex = "omnomnom" ) func LndHubTestServiceInit(lndClientMock lnd.LightningClientWrapper) (svc *service.LndhubService, err error) { @@ -47,8 +53,8 @@ func LndHubTestServiceInit(lndClientMock lnd.LightningClientWrapper) (svc *servi JWTSecret: []byte("SECRET"), JWTAccessTokenExpiry: 3600, JWTRefreshTokenExpiry: 3600, - LNDAddress: lnd1RegtestAddress, - LNDMacaroonHex: lnd1RegtestMacaroonHex, + LNDAddress: mockLNDAddress, + LNDMacaroonHex: mockLNDMacaroonHex, } dbConn, err := db.Open(c.DatabaseUri) if err != nil { @@ -66,27 +72,14 @@ func LndHubTestServiceInit(lndClientMock lnd.LightningClientWrapper) (svc *servi return nil, fmt.Errorf("failed to migrate: %w", err) } - var lndClient lnd.LightningClientWrapper - if lndClientMock == nil { - lndClient, err = lnd.NewLNDclient(lnd.LNDoptions{ - Address: c.LNDAddress, - MacaroonHex: c.LNDMacaroonHex, - }) - if err != nil { - return nil, fmt.Errorf("failed to initialize lnd service client: %w", err) - } - } else { - lndClient = lndClientMock - } - logger := lib.Logger(c.LogFilePath) svc = &service.LndhubService{ Config: c, DB: dbConn, - LndClient: lndClient, + LndClient: lndClientMock, Logger: logger, } - getInfo, err := lndClient.GetInfo(ctx, &lnrpc.GetInfoRequest{}) + getInfo, err := lndClientMock.GetInfo(ctx, &lnrpc.GetInfoRequest{}) if err != nil { logger.Fatalf("Error getting node info: %v", err) } diff --git a/integration_tests/webhook_test.go b/integration_tests/webhook_test.go index b1c21df..85605e3 100644 --- a/integration_tests/webhook_test.go +++ b/integration_tests/webhook_test.go @@ -15,18 +15,16 @@ import ( "github.com/getAlby/lndhub.go/lib/responses" "github.com/getAlby/lndhub.go/lib/service" "github.com/getAlby/lndhub.go/lib/tokens" - "github.com/getAlby/lndhub.go/lnd" "github.com/go-playground/validator/v10" "github.com/labstack/echo/v4" - "github.com/lightningnetwork/lnd/lnrpc" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) type WebHookTestSuite struct { TestSuite - fundingClient *lnd.LNDWrapper service *service.LndhubService + mlnd *MockLND userLogin ExpectedCreateUserResponseBody userToken string webHookServer *httptest.Server @@ -35,19 +33,10 @@ type WebHookTestSuite struct { } func (suite *WebHookTestSuite) SetupSuite() { - lndClient, err := lnd.NewLNDclient(lnd.LNDoptions{ - Address: lnd2RegtestAddress, - MacaroonHex: lnd2RegtestMacaroonHex, - }) - if err != nil { - log.Fatalf("Error setting up funding client: %v", err) - } - suite.fundingClient = lndClient - suite.invoiceChan = make(chan models.Invoice) webhookServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { invoice := models.Invoice{} - err = json.NewDecoder(r.Body).Decode(&invoice) + err := json.NewDecoder(r.Body).Decode(&invoice) if err != nil { suite.echo.Logger.Error(err) close(suite.invoiceChan) @@ -56,7 +45,9 @@ func (suite *WebHookTestSuite) SetupSuite() { suite.invoiceChan <- invoice })) suite.webHookServer = webhookServer - svc, err := LndHubTestServiceInit(nil) + mlnd := newDefaultMockLND() + svc, err := LndHubTestServiceInit(mlnd) + suite.mlnd = mlnd if err != nil { log.Fatalf("Error initializing test service: %v", err) } @@ -88,11 +79,7 @@ func (suite *WebHookTestSuite) SetupSuite() { func (suite *WebHookTestSuite) TestWebHook() { // create incoming invoice and fund account invoice := suite.createAddInvoiceReq(1000, "integration test webhook", suite.userToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoice.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoice, 0, false, nil) assert.NoError(suite.T(), err) invoiceFromWebhook := <-suite.invoiceChan assert.Equal(suite.T(), "integration test webhook", invoiceFromWebhook.Memo) diff --git a/integration_tests/websocket_test.go b/integration_tests/websocket_test.go index 910a264..cc93066 100644 --- a/integration_tests/websocket_test.go +++ b/integration_tests/websocket_test.go @@ -15,11 +15,9 @@ import ( "github.com/getAlby/lndhub.go/lib/responses" "github.com/getAlby/lndhub.go/lib/service" "github.com/getAlby/lndhub.go/lib/tokens" - "github.com/getAlby/lndhub.go/lnd" "github.com/go-playground/validator/v10" "github.com/gorilla/websocket" "github.com/labstack/echo/v4" - "github.com/lightningnetwork/lnd/lnrpc" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) @@ -30,8 +28,8 @@ type KeepAlive struct { type WebSocketTestSuite struct { TestSuite - fundingClient *lnd.LNDWrapper service *service.LndhubService + mlnd *MockLND userLogin ExpectedCreateUserResponseBody userToken string userToken2 string @@ -55,19 +53,12 @@ func (h *WsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func (suite *WebSocketTestSuite) SetupSuite() { - lndClient, err := lnd.NewLNDclient(lnd.LNDoptions{ - Address: lnd2RegtestAddress, - MacaroonHex: lnd2RegtestMacaroonHex, - }) - if err != nil { - log.Fatalf("Error setting up funding client: %v", err) - } - suite.fundingClient = lndClient - - svc, err := LndHubTestServiceInit(nil) + mlnd := newDefaultMockLND() + svc, err := LndHubTestServiceInit(mlnd) if err != nil { log.Fatalf("Error initializing test service: %v", err) } + suite.mlnd = mlnd users, userTokens, err := createUsers(svc, 2) if err != nil { log.Fatalf("Error creating test users: %v", err) @@ -112,11 +103,7 @@ func (suite *WebSocketTestSuite) TestWebSocket() { // create incoming invoice and fund account invoice := suite.createAddInvoiceReq(1000, "integration test websocket 1", suite.userToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoice.PayReq, - FeeLimit: nil, - } - _, err = suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err = suite.mlnd.mockPaidInvoice(invoice, 0, false, nil) assert.NoError(suite.T(), err) _, msg, err = ws.ReadMessage() @@ -143,11 +130,7 @@ func (suite *WebSocketTestSuite) TestWebSocketDoubeSubscription() { _, _, err = ws2.ReadMessage() assert.NoError(suite.T(), err) invoice := suite.createAddInvoiceReq(1000, "integration test websocket 2", suite.userToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoice.PayReq, - FeeLimit: nil, - } - _, err = suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err = suite.mlnd.mockPaidInvoice(invoice, 0, false, nil) assert.NoError(suite.T(), err) _, msg1, err := ws1.ReadMessage() assert.NoError(suite.T(), err) @@ -165,11 +148,7 @@ func (suite *WebSocketTestSuite) TestWebSocketDoubeSubscription() { //close 1 subscription, assert that the existing sub still receives their invoices ws1.Close() invoice = suite.createAddInvoiceReq(1000, "integration test websocket 3", suite.userToken) - sendPaymentRequest = lnrpc.SendRequest{ - PaymentRequest: invoice.PayReq, - FeeLimit: nil, - } - _, err = suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err = suite.mlnd.mockPaidInvoice(invoice, 0, false, nil) assert.NoError(suite.T(), err) _, msg3, err := ws2.ReadMessage() assert.NoError(suite.T(), err) @@ -180,7 +159,6 @@ func (suite *WebSocketTestSuite) TestWebSocketDoubeSubscription() { } func (suite *WebSocketTestSuite) TestWebSocketDoubleUser() { - //create subs for 2 different users, assert that they each get their own invoice updates user1Ws, _, err := websocket.DefaultDialer.Dial(suite.wsUrl, nil) assert.NoError(suite.T(), err) @@ -195,20 +173,12 @@ func (suite *WebSocketTestSuite) TestWebSocketDoubleUser() { assert.NoError(suite.T(), err) // add invoice for user 1 user1Invoice := suite.createAddInvoiceReq(1000, "integration test websocket user 1", suite.userToken) - sendPaymentRequestUser1 := lnrpc.SendRequest{ - PaymentRequest: user1Invoice.PayReq, - FeeLimit: nil, - } // add invoice for user 2 user2Invoice := suite.createAddInvoiceReq(1000, "integration test websocket user 2", suite.userToken2) - sendPaymentRequestUser2 := lnrpc.SendRequest{ - PaymentRequest: user2Invoice.PayReq, - FeeLimit: nil, - } - //pay invoices - _, err = suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequestUser1) + //mock pay invoices + err = suite.mlnd.mockPaidInvoice(user1Invoice, 0, false, nil) assert.NoError(suite.T(), err) - _, err = suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequestUser2) + err = suite.mlnd.mockPaidInvoice(user2Invoice, 0, false, nil) assert.NoError(suite.T(), err) //read user 1 received msg _, user1Msg, err := user1Ws.ReadMessage() @@ -231,20 +201,12 @@ func (suite *WebSocketTestSuite) TestWebSocketDoubleUser() { func (suite *WebSocketTestSuite) TestWebSocketMissingInvoice() { // create incoming invoice and fund account invoice1 := suite.createAddInvoiceReq(1000, "integration test websocket missing invoices", suite.userToken) - sendPaymentRequest := lnrpc.SendRequest{ - PaymentRequest: invoice1.PayReq, - FeeLimit: nil, - } - _, err := suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err := suite.mlnd.mockPaidInvoice(invoice1, 0, false, nil) assert.NoError(suite.T(), err) - // create 2nd invoice and pay it as well + //create 2nd invoice and pay it as well invoice2 := suite.createAddInvoiceReq(1000, "integration test websocket missing invoices 2nd", suite.userToken) - sendPaymentRequest = lnrpc.SendRequest{ - PaymentRequest: invoice2.PayReq, - FeeLimit: nil, - } - _, err = suite.fundingClient.SendPaymentSync(context.Background(), &sendPaymentRequest) + err = suite.mlnd.mockPaidInvoice(invoice2, 0, false, nil) assert.NoError(suite.T(), err) //start listening to websocket after 2nd invoice has been paid