Skip to content

Commit

Permalink
fix inconsistency in name saving.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Aug 20, 2021
1 parent 4215459 commit d79d535
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ type Params struct {
}

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.Write(key)
mac.Write([]byte(name + "@" + s.Domain))
pin = hex.EncodeToString(mac.Sum(nil))

if _, closer, err := db.Get(key); err == nil {
Expand Down
6 changes: 6 additions & 0 deletions makeinvoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"crypto/sha256"
"encoding/hex"
"strconv"
"time"

Expand Down Expand Up @@ -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
return makeinvoice.MakeInvoice(makeinvoice.Params{
Msatoshi: int64(msat),
Expand Down

0 comments on commit d79d535

Please sign in to comment.