-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lnd): use lnd 0.6.1 w/ hold invoices
This is a major commit that changes the way hashes are resolved and swaps are performed with lnd. Here we switch from using a fork of lnd to the main lnd repository. Previously, we used the hash resolver service which made a resolve gRPC call from lnd to xud when lnd accepted an htlc with a payment hash it did not recognize. Now, when we prepare for a swap xud will tell lnd about the hash via `AddHoldInvoice` and subscribe to updates to that invoice via `SubscribeSingleInvoice`. The subscription will alert xud when lnd accepts an htlc for that invoice, at which point xud will attempt to resolve the hash by completing the swap and provide the preimage to lnd via `SettleInvoice`. If a swap fails, the invoice in lnd is canceled via `CancelInvoice`. A new SanitySwapAck packet is necessary for this new approach. Previously, the sanity swap payment and the SanitySwap packet (which informs the peer of the hash for the swap would) be sent at the same time. A node that received a resolve request for an amount of 1 satoshi and a hash it did not recognize would wait a short while to see if it received a SanitySwap packet for that hash. With hold invoices, lnd must be informed of the payment hash via `AddInvoice` before it receives the htlc, otherwise it will fail the htlc immediately. Thus, the SanitySwapAck packet is used to inform the peer that it is ready to accept the sanity swap payment. Closes #798.
- Loading branch information
Showing
48 changed files
with
18,859 additions
and
10,641 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** General information about the state of this lnd client. */ | ||
export type LndInfo = { | ||
error?: string; | ||
channels?: ChannelCount; | ||
chains?: Chain[]; | ||
blockheight?: number; | ||
uris?: string[]; | ||
version?: string; | ||
alias?: string; | ||
}; | ||
|
||
export type ChannelCount = { | ||
active: number, | ||
inactive?: number, | ||
pending: number, | ||
}; | ||
|
||
export type Chain = { | ||
network: string, | ||
chain: string, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.