lntest: add AMP itest
This commit is contained in:
3 files changed
+220
-4
No files matched your search
@@ -2,7 +2,6 @@ package invoicesrpc
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
@@ -24,7 +23,7 @@ func decodePayReq(invoice *channeldb.Invoice,
|
||||
if paymentRequest == "" {
|
||||
preimage := invoice.Terms.PaymentPreimage
|
||||
if preimage == nil {
|
||||
return nil, errors.New("cannot reconstruct pay req")
|
||||
return &zpay32.Invoice{}, nil
|
||||
}
|
||||
hash := [32]byte(preimage.Hash())
|
||||
return &zpay32.Invoice{
|
||||
@@ -51,6 +50,11 @@ func CreateRPCInvoice(invoice *channeldb.Invoice,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var rHash []byte
|
||||
if decoded.PaymentHash != nil {
|
||||
rHash = decoded.PaymentHash[:]
|
||||
}
|
||||
|
||||
var descHash []byte
|
||||
if decoded.DescriptionHash != nil {
|
||||
descHash = decoded.DescriptionHash[:]
|
||||
@@ -144,8 +148,8 @@ func CreateRPCInvoice(invoice *channeldb.Invoice,
|
||||
}
|
||||
|
||||
rpcInvoice := &lnrpc.Invoice{
|
||||
Memo: string(invoice.Memo[:]),
|
||||
RHash: decoded.PaymentHash[:],
|
||||
Memo: string(invoice.Memo),
|
||||
RHash: rHash,
|
||||
Value: int64(satAmt),
|
||||
ValueMsat: int64(invoice.Terms.Value),
|
||||
CreationDate: invoice.CreationDate.Unix(),
|
||||
|
||||
Reference in new issue
Block a user