Add alternate sign address to ticket search result

This commit is contained in:
jholdstock 2021-11-11 12:56:12 +00:00 committed by Jamie Holdstock
parent efa5a09820
commit 6260e4ee5b
2 changed files with 24 additions and 2 deletions

View File

@ -31,6 +31,7 @@ type searchResult struct {
Hash string Hash string
Found bool Found bool
Ticket database.Ticket Ticket database.Ticket
AltSig string
VoteChanges map[uint32]database.VoteChangeRecord VoteChanges map[uint32]database.VoteChangeRecord
MaxVoteChanges int MaxVoteChanges int
} }
@ -122,11 +123,24 @@ func ticketSearch(c *gin.Context) {
return return
} }
altSigData, err := db.AltSigData(hash)
if err != nil {
log.Errorf("db.AltSigData error (ticketHash=%s): %v", hash, err)
c.String(http.StatusInternalServerError, "Error getting alt sig from db")
return
}
altSig := ""
if altSigData != nil {
altSig = altSigData.AltSigAddr
}
c.HTML(http.StatusOK, "admin.html", gin.H{ c.HTML(http.StatusOK, "admin.html", gin.H{
"SearchResult": searchResult{ "SearchResult": searchResult{
Hash: hash, Hash: hash,
Found: found, Found: found,
Ticket: ticket, Ticket: ticket,
AltSig: altSig,
VoteChanges: voteChanges, VoteChanges: voteChanges,
MaxVoteChanges: cfg.MaxVoteChangeRecords, MaxVoteChanges: cfg.MaxVoteChangeRecords,
}, },

View File

@ -28,6 +28,10 @@
<th>Ticket Outcome</th> <th>Ticket Outcome</th>
<td>{{ .Ticket.Outcome }}</td> <td>{{ .Ticket.Outcome }}</td>
</tr> </tr>
<tr>
<th>Voting WIF</th>
<td>{{ .Ticket.VotingWIF }}</td>
</tr>
<tr> <tr>
<th>Commitment Address</th> <th>Commitment Address</th>
<td> <td>
@ -37,8 +41,12 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Voting WIF</th> <th>Alternate Signing Address</th>
<td>{{ .Ticket.VotingWIF }}</td> <td>
<a href="{{ addressURL .AltSig }}">
{{ .AltSig }}
</a>
</td>
</tr> </tr>
</table> </table>