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()
|
missed.SortByPurchaseHeight()
|
||||||
|
|
||||||
xpubs, err := w.db.AllXPubs()
|
currentXPub, err := w.db.FeeXPub()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.log.Errorf("db.AllXPubs error: %v", err)
|
w.log.Errorf("db.FeeXPub error: %v", err)
|
||||||
c.String(http.StatusInternalServerError, "Error getting xpubs from db")
|
c.String(http.StatusInternalServerError, "Error getting current xpub from db")
|
||||||
return
|
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{
|
c.HTML(http.StatusOK, "admin.html", gin.H{
|
||||||
"SearchResult": searchResult,
|
"SearchResult": searchResult,
|
||||||
"WebApiCache": cacheData,
|
"WebApiCache": cacheData,
|
||||||
@ -174,7 +184,8 @@ func (w *WebAPI) renderAdmin(c *gin.Context, searchResult *searchResult) {
|
|||||||
"WalletStatus": w.walletStatus(c),
|
"WalletStatus": w.walletStatus(c),
|
||||||
"DcrdStatus": w.dcrdStatus(c),
|
"DcrdStatus": w.dcrdStatus(c),
|
||||||
"MissedTickets": missed,
|
"MissedTickets": missed,
|
||||||
"XPubs": xpubs,
|
"CurrentXPub": currentXPub,
|
||||||
|
"OldXPubs": oldXPubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -251,8 +251,26 @@
|
|||||||
<div class="collapsible-tab-content">
|
<div class="collapsible-tab-content">
|
||||||
|
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<h1>All X Pubs</h1>
|
<h1>Current X Pub</h1>
|
||||||
{{ with .XPubs }}
|
<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">
|
<table class="mx-auto">
|
||||||
<thead>
|
<thead>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
@ -271,8 +289,8 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{{ end}}
|
|
||||||
</div>
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user