lnrpc: set either payHash or setId depending on payreq type
This commit is contained in:
parent
8c404ade18
commit
64d07558d9
@ -702,9 +702,31 @@ func (r *RouterBackend) extractIntentFromSendRequest(
|
||||
payIntent.MaxParts = 1
|
||||
}
|
||||
|
||||
err = payIntent.SetPaymentHash(*payReq.PaymentHash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
destKey := payReq.Destination.SerializeCompressed()
|
||||
|
Loading…
Reference in New Issue
Block a user