webapi: Distinguish between current/old xpub
Showing current and old pubkeys under separate headers makes the information easier to parse, and also fixes a bug where the current pubkey was showing a retired timestamp of unix epoch.
This commit is contained in:
parent
b6ffde116a
commit
ca8d67e34a
@ -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.AllXPubs error: %v", err)
|
||||
c.String(http.StatusInternalServerError, "Error getting xpubs from db")
|
||||
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 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,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -251,8 +251,26 @@
|
||||
<div class="collapsible-tab-content">
|
||||
|
||||
<div class="p-2">
|
||||
<h1>All X Pubs</h1>
|
||||
{{ with .XPubs }}
|
||||
<h1>Current X Pub</h1>
|
||||
<table class="mx-auto">
|
||||
<thead>
|
||||
<th>ID</th>
|
||||
<th>Key</th>
|
||||
<th>Last Address Index</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ .CurrentXPub.ID }}</td>
|
||||
<td>{{ .CurrentXPub.Key }}</td>
|
||||
<td>{{ .CurrentXPub.LastUsedIdx }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{{ with .OldXPubs }}
|
||||
<div class="p-2">
|
||||
<h1>Old X Pubs</h1>
|
||||
<table class="mx-auto">
|
||||
<thead>
|
||||
<th>ID</th>
|
||||
@ -271,8 +289,8 @@
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
{{ end}}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user