diff --git a/internal/webapi/admin.go b/internal/webapi/admin.go index d52963e5..6af358c6 100644 --- a/internal/webapi/admin.go +++ b/internal/webapi/admin.go @@ -160,13 +160,23 @@ func (w *WebAPI) renderAdmin(c *gin.Context, searchResult *searchResult) { missed.SortByPurchaseHeight() - xpubs, err := w.db.AllXPubs() + currentXPub, err := w.db.FeeXPub() + if err != nil { + w.log.Errorf("db.FeeXPub error: %v", err) + c.String(http.StatusInternalServerError, "Error getting current xpub from db") + return + } + + oldXPubs, err := w.db.AllXPubs() if err != nil { w.log.Errorf("db.AllXPubs error: %v", err) - c.String(http.StatusInternalServerError, "Error getting xpubs from db") + c.String(http.StatusInternalServerError, "Error getting all xpubs from db") return } + // Remove current xpub from the list of old xpubs. + delete(oldXPubs, currentXPub.ID) + c.HTML(http.StatusOK, "admin.html", gin.H{ "SearchResult": searchResult, "WebApiCache": cacheData, @@ -174,7 +184,8 @@ func (w *WebAPI) renderAdmin(c *gin.Context, searchResult *searchResult) { "WalletStatus": w.walletStatus(c), "DcrdStatus": w.dcrdStatus(c), "MissedTickets": missed, - "XPubs": xpubs, + "CurrentXPub": currentXPub, + "OldXPubs": oldXPubs, }) } diff --git a/internal/webapi/templates/admin.html b/internal/webapi/templates/admin.html index f6a7255f..018223cd 100644 --- a/internal/webapi/templates/admin.html +++ b/internal/webapi/templates/admin.html @@ -251,8 +251,26 @@

{{ pluralize (len .MissedTickets) "Missed Ticket" }}

-

All X Pubs

- {{ with .XPubs }} +

Current X Pub

+ + + + + + + + + + + + + +
IDKeyLast Address Index
{{ .CurrentXPub.ID }}{{ .CurrentXPub.Key }}{{ .CurrentXPub.LastUsedIdx }}
+
+ + {{ with .OldXPubs }} +
+

Old X Pubs

@@ -271,8 +289,8 @@

All X Pubs

{{ end }}
ID
- {{ end}}
+ {{ end }}