[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taldir] branch master updated: relative paid for response
From: |
gnunet |
Subject: |
[taler-taldir] branch master updated: relative paid for response |
Date: |
Tue, 12 Jul 2022 13:04:11 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository taldir.
The following commit(s) were added to refs/heads/master by this push:
new f758b7f relative paid for response
f758b7f is described below
commit f758b7f7a501bca2b2a57a6b6da356f167ea8fc4
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Jul 12 13:04:09 2022 +0200
relative paid for response
---
pkg/rest/taldir.go | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go
index 95e2c71..63ee131 100644
--- a/pkg/rest/taldir.go
+++ b/pkg/rest/taldir.go
@@ -172,9 +172,6 @@ type Entry struct {
// Public key of the user to register in base32
PublicKey string `json:"public_key"`
- // Time of (re)registration.
- RegisteredAt int64 `json:"-"`
-
// How long the registration lasts in microseconds
Duration time.Duration `json:"-"`
}
@@ -361,7 +358,6 @@ func (t *Taldir) validationRequest(w http.ResponseWriter, r
*http.Request){
entry.Inbox = validation.Inbox
tmpDuration := (entry.Duration.Microseconds() + validation.Duration) * 1000
entry.Duration = time.Duration(tmpDuration)
- entry.RegisteredAt = time.Now().UnixMicro()
entry.PublicKey = validation.PublicKey
err = t.Db.First(&entry, "hs_address = ?", entry.HsAddress).Error
if err == nil {
@@ -453,8 +449,7 @@ func (t *Taldir) registerRequest(w http.ResponseWriter, r
*http.Request){
entryModified := (req.Inbox != entry.Inbox) ||
(req.PublicKey != entry.PublicKey)
log.Println("Entry for this address already exists..")
- regAt := time.UnixMicro(entry.RegisteredAt)
- entryValidity := regAt.Add(entry.Duration)
+ entryValidity := entry.CreatedAt.Add(entry.Duration)
requestedValidity := entryValidity.Add(reqDuration)
log.Printf("Entry valid until: %s , requested until: %s\n", entryValidity,
requestedValidity)
// NOTE: The extension must be at least one month
@@ -462,7 +457,7 @@ func (t *Taldir) registerRequest(w http.ResponseWriter, r
*http.Request){
// Nothing changed. Return validity
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")
- w.Write([]byte("{\"valid_until\": " + entryValidity.String() + "}"))
+ w.Write([]byte(fmt.Sprintf("{\"valid_for\": %d}",
time.Until(entryValidity).Microseconds())))
return
} else {
// Entry modified or duration extension requested
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-taldir] branch master updated: relative paid for response,
gnunet <=