Add nostr nip-05 registration with lnd invoices #1
1 changed files with 1 additions and 3 deletions
|
@ -7,7 +7,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.minhas.io/asara/well-goknown/config"
|
"git.minhas.io/asara/well-goknown/config"
|
||||||
"git.minhas.io/asara/well-goknown/logger"
|
"git.minhas.io/asara/well-goknown/logger"
|
||||||
|
@ -49,14 +48,13 @@ func Request(rKey string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add a minute to the expiry time to ensure entries aren't removed from redis before they are expired
|
// add a minute to the expiry time to ensure entries aren't removed from redis before they are expired
|
||||||
expiryTime := time.Now().Local().Add(time.Minute * time.Duration(expiryInMin+1)).Unix()
|
|
||||||
|
|
||||||
paymentReq := invoice.PaymentRequest
|
paymentReq := invoice.PaymentRequest
|
||||||
rHash := hex.EncodeToString(invoice.RHash)
|
rHash := hex.EncodeToString(invoice.RHash)
|
||||||
|
|
||||||
// write lnd request to redis
|
// write lnd request to redis
|
||||||
redisCli := redis.LndRedisConn.Client
|
redisCli := redis.LndRedisConn.Client
|
||||||
err = redisCli.Set(ctx, rKey, fmt.Sprintf("%d:%s:%s", expiryTime, rHash, paymentReq), 0).Err()
|
err = redisCli.Set(ctx, rKey, rHash, 0).Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Error().Msg("unable to connect to redis when writing lnd request")
|
l.Error().Msg("unable to connect to redis when writing lnd request")
|
||||||
return "", errors.New("unable to make the request, please try again")
|
return "", errors.New("unable to make the request, please try again")
|
||||||
|
|
Loading…
Reference in a new issue