forked from heierbtc/satdress-mirror
fix inconsistency in name saving.
This commit is contained in:
parent
42154594c9
commit
d79d5351ff
4
db.go
4
db.go
|
@ -21,10 +21,10 @@ type Params struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SaveName(name string, params *Params, providedPin string) (pin string, err error) {
|
func SaveName(name string, params *Params, providedPin string) (pin string, err error) {
|
||||||
key := []byte(name + "@" + s.Domain)
|
key := []byte(name)
|
||||||
|
|
||||||
mac := hmac.New(sha256.New, []byte(s.Secret))
|
mac := hmac.New(sha256.New, []byte(s.Secret))
|
||||||
mac.Write(key)
|
mac.Write([]byte(name + "@" + s.Domain))
|
||||||
pin = hex.EncodeToString(mac.Sum(nil))
|
pin = hex.EncodeToString(mac.Sum(nil))
|
||||||
|
|
||||||
if _, closer, err := db.Get(key); err == nil {
|
if _, closer, err := db.Get(key); err == nil {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
|
"encoding/hex"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -50,6 +51,11 @@ func makeInvoice(params *Params, msat int) (bolt11 string, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debug().Int("msatoshi", msat).
|
||||||
|
Interface("backend", backend).
|
||||||
|
Str("description_hash", hex.EncodeToString(h[:])).
|
||||||
|
Msg("generating invoice")
|
||||||
|
|
||||||
// actually generate the invoice
|
// actually generate the invoice
|
||||||
return makeinvoice.MakeInvoice(makeinvoice.Params{
|
return makeinvoice.MakeInvoice(makeinvoice.Params{
|
||||||
Msatoshi: int64(msat),
|
Msatoshi: int64(msat),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user