lnrpc: set either payHash or setId depending on payreq type
This commit is contained in:
parent
8c404ade18
commit
64d07558d9
@ -702,10 +702,32 @@ func (r *RouterBackend) extractIntentFromSendRequest(
|
|||||||
payIntent.MaxParts = 1
|
payIntent.MaxParts = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if payReq.Features.HasFeature(lnwire.AMPOptional) {
|
||||||
|
// Generate random SetID and root share.
|
||||||
|
var setID [32]byte
|
||||||
|
_, err = rand.Read(setID[:])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var rootShare [32]byte
|
||||||
|
_, err = rand.Read(rootShare[:])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err := payIntent.SetAMP(&routing.AMPOptions{
|
||||||
|
SetID: setID,
|
||||||
|
RootShare: rootShare,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
err = payIntent.SetPaymentHash(*payReq.PaymentHash)
|
err = payIntent.SetPaymentHash(*payReq.PaymentHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
destKey := payReq.Destination.SerializeCompressed()
|
destKey := payReq.Destination.SerializeCompressed()
|
||||||
copy(payIntent.Target[:], destKey)
|
copy(payIntent.Target[:], destKey)
|
||||||
|
Loading…
Reference in New Issue
Block a user