Merge pull request #5180 from GameXG/master2

lnd: fix #5179 panic: runtime error: invalid memory address or nil po…
This commit is contained in:
Johan T. Halseth 2021-04-07 09:10:22 +02:00 committed by GitHub
commit 46c9140ac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3096,7 +3096,7 @@ func (r *rpcServer) PendingChannels(ctx context.Context,
return nil, err return nil, err
} }
resp.TotalLimboBalance += int64(forceClose.LimboBalance) resp.TotalLimboBalance += forceClose.LimboBalance
resp.PendingForceClosingChannels = append( resp.PendingForceClosingChannels = append(
resp.PendingForceClosingChannels, resp.PendingForceClosingChannels,
@ -4311,6 +4311,10 @@ func (r *rpcServer) extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPayme
if len(rpcPayReq.PaymentAddr) != 0 && len(rpcPayReq.PaymentAddr) != 32 { if len(rpcPayReq.PaymentAddr) != 0 && len(rpcPayReq.PaymentAddr) != 32 {
return payIntent, errors.New("invalid payment address length") return payIntent, errors.New("invalid payment address length")
} }
if payIntent.paymentAddr == nil {
payIntent.paymentAddr = &[32]byte{}
}
copy(payIntent.paymentAddr[:], rpcPayReq.PaymentAddr) copy(payIntent.paymentAddr[:], rpcPayReq.PaymentAddr)
// Otherwise, If the payment request field was not specified // Otherwise, If the payment request field was not specified