mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 03:57:40 +02:00
multi: pass blinding point through to reconstruction
This commit is contained in:
@@ -150,20 +150,27 @@ func (p *OnionProcessor) Stop() error {
|
||||
// ReconstructHopIterator attempts to decode a valid sphinx packet from the passed io.Reader
|
||||
// instance using the rHash as the associated data when checking the relevant
|
||||
// MACs during the decoding process.
|
||||
func (p *OnionProcessor) ReconstructHopIterator(r io.Reader, rHash []byte) (
|
||||
Iterator, error) {
|
||||
func (p *OnionProcessor) ReconstructHopIterator(r io.Reader, rHash []byte,
|
||||
blindingPoint *btcec.PublicKey) (Iterator, error) {
|
||||
|
||||
onionPkt := &sphinx.OnionPacket{}
|
||||
if err := onionPkt.Decode(r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var opts []sphinx.ProcessOnionOpt
|
||||
if blindingPoint != nil {
|
||||
opts = append(opts, sphinx.WithBlindingPoint(blindingPoint))
|
||||
}
|
||||
|
||||
// Attempt to process the Sphinx packet. We include the payment hash of
|
||||
// the HTLC as it's authenticated within the Sphinx packet itself as
|
||||
// associated data in order to thwart attempts a replay attacks. In the
|
||||
// case of a replay, an attacker is *forced* to use the same payment
|
||||
// hash twice, thereby losing their money entirely.
|
||||
sphinxPacket, err := p.router.ReconstructOnionPacket(onionPkt, rHash)
|
||||
sphinxPacket, err := p.router.ReconstructOnionPacket(
|
||||
onionPkt, rHash, opts...,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user