htlcswitch: add blinding point to sphinx iterator for decoding
This commit is contained in:
4 files changed
+54
-26
No files matched your search
@@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
@@ -18,7 +17,6 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/queue"
|
||||
"github.com/lightningnetwork/lnd/tlv"
|
||||
)
|
||||
|
||||
// htlcIncomingContestResolver is a ContractResolver that's able to resolve an
|
||||
@@ -522,18 +520,15 @@ func (h *htlcIncomingContestResolver) Supplement(htlc channeldb.HTLC) {
|
||||
func (h *htlcIncomingContestResolver) decodePayload() (*hop.Payload,
|
||||
[]byte, error) {
|
||||
|
||||
var blindingPoint *btcec.PublicKey
|
||||
h.htlc.BlindingPoint.WhenSome(
|
||||
func(b tlv.RecordT[lnwire.BlindingPointTlvType,
|
||||
*btcec.PublicKey]) {
|
||||
|
||||
blindingPoint = b.Val
|
||||
},
|
||||
)
|
||||
blindingInfo := hop.ReconstructBlindingInfo{
|
||||
IncomingAmt: h.htlc.Amt,
|
||||
IncomingExpiry: h.htlc.RefundTimeout,
|
||||
BlindingKey: h.htlc.BlindingPoint,
|
||||
}
|
||||
|
||||
onionReader := bytes.NewReader(h.htlc.OnionBlob[:])
|
||||
iterator, err := h.OnionProcessor.ReconstructHopIterator(
|
||||
onionReader, h.htlc.RHash[:], blindingPoint,
|
||||
onionReader, h.htlc.RHash[:], blindingInfo,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
sphinx "github.com/lightningnetwork/lightning-onion"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
@@ -290,7 +289,7 @@ type mockOnionProcessor struct {
|
||||
}
|
||||
|
||||
func (o *mockOnionProcessor) ReconstructHopIterator(r io.Reader, rHash []byte,
|
||||
blindingPoint *btcec.PublicKey) (hop.Iterator, error) {
|
||||
_ hop.ReconstructBlindingInfo) (hop.Iterator, error) {
|
||||
|
||||
data, err := ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channeldb/models"
|
||||
@@ -42,7 +41,7 @@ type OnionProcessor interface {
|
||||
// ReconstructHopIterator attempts to decode a valid sphinx packet from
|
||||
// the passed io.Reader instance.
|
||||
ReconstructHopIterator(r io.Reader, rHash []byte,
|
||||
blindingKey *btcec.PublicKey) (hop.Iterator, error)
|
||||
blindingInfo hop.ReconstructBlindingInfo) (hop.Iterator, error)
|
||||
}
|
||||
|
||||
// UtxoSweeper defines the sweep functions that contract court requires.
|
||||
|
||||
Reference in new issue
Block a user