mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-22 11:02:36 +02:00
routerrpc+routing: set AMP options for payments specified as AMP in SendPayment
This commit is contained in:
@ -1806,14 +1806,33 @@ type AMPOptions struct {
|
||||
// SetPaymentHash sets the given hash as the payment's overall hash. This
|
||||
// should only be used for non-AMP payments.
|
||||
func (l *LightningPayment) SetPaymentHash(hash lntypes.Hash) error {
|
||||
if l.amp != nil {
|
||||
return fmt.Errorf("cannot set payment hash for AMP payment")
|
||||
}
|
||||
|
||||
l.paymentHash = &hash
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetAMP sets the given AMP options for the payment.
|
||||
func (l *LightningPayment) SetAMP(amp *AMPOptions) error {
|
||||
if l.paymentHash != nil {
|
||||
return fmt.Errorf("cannot set amp options for payment " +
|
||||
"with payment hash")
|
||||
}
|
||||
|
||||
l.amp = amp
|
||||
return nil
|
||||
}
|
||||
|
||||
// Identifier returns a 32-byte slice that uniquely identifies this single
|
||||
// payment. For non-AMP payments this will be the payment hash, for AMP
|
||||
// payments this will be the used SetID.
|
||||
func (l *LightningPayment) Identifier() [32]byte {
|
||||
if l.amp != nil {
|
||||
return l.amp.SetID
|
||||
}
|
||||
|
||||
return *l.paymentHash
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user