Skip to content

Commit

Permalink
Merge pull request #790 from lightninglabs/reverse-invoice-fix
Browse files Browse the repository at this point in the history
mod+itest: reproduce and fix reverse direction invoice payment, bump to rc4
  • Loading branch information
guggero authored Jul 12, 2024
2 parents 2f0f95d + b9e6bb5 commit d3bdd03
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 42 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Visit https://localhost:8443 to access Terminal.

Note that a password with a minimum of 8 characters is required to run Lightning Terminal. In a production environment, it's recommended that you store this password as an environment variable to avoid it being recorded in the command history.

To use LiT with a remote `lnd` instance please [follow these instructions](./doc/config-lnd-remote.md). If you would like to replace your existing LND instance with the one integrated within LiT please see [configuring Terminal](./doc/config-lnd-integrated.md).
To use LiT with a remote `lnd` instance please [follow these instructions](./docs/config-lnd-remote.md). If you would like to replace your existing LND instance with the one integrated within LiT please see [configuring Terminal](./doc/config-lnd-integrated.md).

## LND
Note that LiT requires `lnd` to be built with **all of its subservers** and requires running at least v0.11.0. Download the latest [official release binary](https://github.com/lightningnetwork/lnd/releases/latest) or build `lnd` from source by following the [installation instructions](https://github.com/lightningnetwork/lnd/blob/master/docs/INSTALL.md). If you choose to build `lnd` from source, use the following command to enable all the relevant subservers:
Expand All @@ -43,7 +43,7 @@ Note that LiT requires `lnd` to be built with **all of its subservers** and requ

## Interaction
If you plan to run LiT on a remote machine but access the web-interface from your computer you may not want to deal with self-signed certificate browser warnings. To avoid these warnings configure the HTTP server to use a certificate from [Let's Encrypt](https://letsencrypt.org/). View the
[Let's Encrypt Configuration](./doc/letsencrypt.md) doc for instructions on how to configure this.
[Let's Encrypt Configuration](./docs/letsencrypt.md) doc for instructions on how to configure this.

## Upgrading
If you used command line arguments with previous versions then you don't need to change anything when upgrading.
Expand All @@ -56,13 +56,13 @@ To upgrade from v0.1.1-alpha or earlier simply create a `lit.conf` file in your
Move all the configuration settings specific to LiT from `lnd.conf` to `lit.conf` and remove any previous LiT-specific customizations from the configuration settings in `lnd.conf`. Note that any section headers (`[ Example ]`) in `lit.conf` should be removed or changed to comments (`# Example`).

## Usage
Read the [walkthrough](doc/WALKTHROUGH.md) document to learn more about how to use LiT.
Read the [walkthrough](docs/WALKTHROUGH.md) document to learn more about how to use LiT.

## Troubleshooting
If you encounter any issues please see our [troubleshooting guide](./doc/troubleshooting.md).
If you encounter any issues please see our [troubleshooting guide](./docs/troubleshooting.md).

## Build from source
If you’d prefer to compile from source code please follow [these instructions](./doc/compile.md).
If you’d prefer to compile from source code please follow [these instructions](./docs/compile.md).

## Compatibility

Expand Down Expand Up @@ -126,9 +126,9 @@ in remote mode (meaning that `lnd-mode=remote` is set). It shows the

LiT offers two main operating modes, one in which [`lnd` is running inside the
LiT process (called "lnd integrated mode", set by `lnd-mode=integrated` config
option)](doc/config-lnd-integrated.md) and one in which [`lnd` is running in
option)](docs/config-lnd-integrated.md) and one in which [`lnd` is running in
a standalone process on the same or remote machine (called "lnd remote mode",
set by `lnd-mode=remote` config option)](doc/config-lnd-remote.md).
set by `lnd-mode=remote` config option)](docs/config-lnd-remote.md).

In addition to those main modes, the individual bundled daemons (Faraday, Loop
and Pool) can be toggled to be integrated or remote as well, or as disabled.
Expand Down
2 changes: 1 addition & 1 deletion cmd/litcli/ln.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ func addInvoice(ctx *cli.Context) error {
ValueMsat: int64(numMSats),
DescriptionHash: descHash,
FallbackAddr: ctx.String("fallback_addr"),
Expiry: int64(timeoutSeconds),
Expiry: int64(ctx.Uint64("expiry")),
Private: ctx.Bool("private"),
IsAmp: ctx.Bool("amp"),
RouteHints: []*lnrpc.RouteHint{
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ require (
github.com/lightninglabs/loop/swapserverrpc v1.0.8
github.com/lightninglabs/pool v0.6.5-beta.0.20240604070222-e121aadb3289
github.com/lightninglabs/pool/auctioneerrpc v1.1.2
github.com/lightninglabs/taproot-assets v0.4.0-alpha.rc3
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240709210732-0cd11ad84792
github.com/lightninglabs/taproot-assets v0.4.0-rc4
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240712025014-90f997c908d0
github.com/lightningnetwork/lnd/cert v1.2.2
github.com/lightningnetwork/lnd/fn v1.1.0
github.com/lightningnetwork/lnd/kvdb v1.4.8
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1175,12 +1175,12 @@ github.com/lightninglabs/pool/auctioneerrpc v1.1.2 h1:Dbg+9Z9jXnhimR27EN37foc4aB
github.com/lightninglabs/pool/auctioneerrpc v1.1.2/go.mod h1:1wKDzN2zEP8srOi0B9iySlEsPdoPhw6oo3Vbm1v4Mhw=
github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display h1:pRdza2wleRN1L2fJXd6ZoQ9ZegVFTAb2bOQfruJPKcY=
github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
github.com/lightninglabs/taproot-assets v0.4.0-alpha.rc3 h1:Ovt4wMhCIqdw+uNwJaSfM/fWpn06n51b4rlIadAnL2g=
github.com/lightninglabs/taproot-assets v0.4.0-alpha.rc3/go.mod h1:oAiEnRj2sCbPHAURot+tmKbyDhIoxnvkmag0JqlF1bs=
github.com/lightninglabs/taproot-assets v0.4.0-rc4 h1:tl8gClGZBmLlkMxfDRVAdIhx+LyhThZCEjYBpuM37pc=
github.com/lightninglabs/taproot-assets v0.4.0-rc4/go.mod h1:oAiEnRj2sCbPHAURot+tmKbyDhIoxnvkmag0JqlF1bs=
github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f h1:Pua7+5TcFEJXIIZ1I2YAUapmbcttmLj4TTi786bIi3s=
github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI=
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240709210732-0cd11ad84792 h1:bM4UmjVTvhqwDCMzLZIDMecfo/mei4OS/BFLUzHiDNc=
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240709210732-0cd11ad84792/go.mod h1:L3IArArdRrWtuw+wNsUlibuGmf/08Odsm/zo3+bPXuM=
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240712025014-90f997c908d0 h1:V+PoltFSxN5oijkErYe+QbnVz5WJjBsAzaMNRrhmz3Q=
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240712025014-90f997c908d0/go.mod h1:L3IArArdRrWtuw+wNsUlibuGmf/08Odsm/zo3+bPXuM=
github.com/lightningnetwork/lnd/cert v1.2.2 h1:71YK6hogeJtxSxw2teq3eGeuy4rHGKcFf0d0Uy4qBjI=
github.com/lightningnetwork/lnd/cert v1.2.2/go.mod h1:jQmFn/Ez4zhDgq2hnYSw8r35bqGVxViXhX6Cd7HXM6U=
github.com/lightningnetwork/lnd/clock v1.1.1 h1:OfR3/zcJd2RhH0RU+zX/77c0ZiOnIMsDIBjgjWdZgA0=
Expand Down
16 changes: 12 additions & 4 deletions itest/assets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func createTestAssetNetwork(t *harnessTest, net *NetworkHarness, charlieTap,
AssetId: assetID,
PeerPubkey: fabiaTap.node.PubKey[:],
FeeRateSatPerVbyte: 5,
PushSat: 1065,
},
)
require.NoError(t.t, err)
Expand Down Expand Up @@ -662,7 +663,7 @@ func createAndPayNormalInvoiceWithBtc(t *testing.T, src, dst *HarnessNode,
}

func createAndPayNormalInvoice(t *testing.T, src, rfqPeer, dst *HarnessNode,
amountSat btcutil.Amount, assetID []byte) uint64 {
amountSat btcutil.Amount, assetID []byte, smallShards bool) uint64 {

ctxb := context.Background()
ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout)
Expand All @@ -676,7 +677,9 @@ func createAndPayNormalInvoice(t *testing.T, src, rfqPeer, dst *HarnessNode,
})
require.NoError(t, err)

return payInvoiceWithAssets(t, src, rfqPeer, invoiceResp, assetID)
return payInvoiceWithAssets(
t, src, rfqPeer, invoiceResp, assetID, smallShards,
)
}

func payInvoiceWithSatoshi(t *testing.T, payer *HarnessNode,
Expand All @@ -703,7 +706,8 @@ func payInvoiceWithSatoshi(t *testing.T, payer *HarnessNode,
}

func payInvoiceWithAssets(t *testing.T, payer, rfqPeer *HarnessNode,
invoice *lnrpc.AddInvoiceResponse, assetID []byte) uint64 {
invoice *lnrpc.AddInvoiceResponse, assetID []byte,
smallShards bool) uint64 {

ctxb := context.Background()
ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout)
Expand Down Expand Up @@ -782,9 +786,13 @@ func payInvoiceWithAssets(t *testing.T, payer, rfqPeer *HarnessNode,
PaymentRequest: invoice.PaymentRequest,
TimeoutSeconds: 2,
FirstHopCustomRecords: encodeResp.CustomRecords,
MaxShardSizeMsat: 80_000_000,
FeeLimitMsat: 1_000_000,
}

if smallShards {
sendReq.MaxShardSizeMsat = 80_000_000
}

stream, err := payer.RouterClient.SendPaymentV2(ctxt, sendReq)
require.NoError(t, err)

Expand Down
Loading

0 comments on commit d3bdd03

Please sign in to comment.