client: LoopOutQuote to support estimate using v3 htlc

This commit is contained in:
Andras Banki-Horvath 2022-05-16 18:37:53 +02:00
parent 391ef57ea3
commit bf59159ddb
No known key found for this signature in database
GPG key ID: 80E5375C094198D8
2 changed files with 48 additions and 21 deletions

View file

@ -108,17 +108,30 @@ type Htlc struct {
}
var (
quoteKey [33]byte
// dummyPubKey is a valid public key use for the quote htlc
// construction.
dummyPubKey = [33]byte{
0x03, 0x26, 0x89, 0xc7, 0xc2, 0xda, 0xb1, 0x33, 0x09, 0xfb,
0x14, 0x3e, 0x0e, 0x8f, 0xe3, 0x96, 0x34, 0x25, 0x21, 0x88,
0x7e, 0x97, 0x66, 0x90, 0xb6, 0xb4, 0x7f, 0x5b, 0x2a, 0x4b,
0x7d, 0x44, 0x8e,
}
// quoteHash is an empty hash used for the quote htlc construction.
quoteHash lntypes.Hash
// QuoteHtlc is a template script just used for fee estimation. It uses
// the maximum value for cltv expiry to get the maximum (worst case)
// script size.
QuoteHtlc, _ = NewHtlc(
HtlcV2,
^int32(0), quoteKey, quoteKey, quoteHash, HtlcP2WSH,
&chaincfg.MainNetParams,
// QuoteHtlcP2WSH is a template script just used for sweep fee
// estimation.
QuoteHtlcP2WSH, _ = NewHtlc(
HtlcV2, ^int32(0), dummyPubKey, dummyPubKey, quoteHash,
HtlcP2WSH, &chaincfg.MainNetParams,
)
// QuoteHtlcP2TR is a template script just used for sweep fee
// estimation.
QuoteHtlcP2TR, _ = NewHtlc(
HtlcV3, ^int32(0), dummyPubKey, dummyPubKey, quoteHash,
HtlcP2TR, &chaincfg.MainNetParams,
)
// ErrInvalidScriptVersion is returned when an unknown htlc version