Fix isOwn flag for mempool transactions

This commit is contained in:
Martin Boehm 2022-03-07 09:56:02 +01:00
parent a282cde045
commit fad284a425
2 changed files with 7 additions and 0 deletions

View File

@ -923,6 +923,7 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco
if option == AccountDetailsTxidHistory {
txids = append(txids, tx.Txid)
} else if option >= AccountDetailsTxHistoryLight {
setIsOwnAddress(tx, address)
txs = append(txs, tx)
}
}

View File

@ -454,6 +454,7 @@ func (s *PublicServer) parseTemplates() []*template.Template {
"formatAmount": s.formatAmount,
"formatAmountWithDecimals": formatAmountWithDecimals,
"setTxToTemplateData": setTxToTemplateData,
"isOwnAddress": isOwnAddress,
"toJSON": toJSON,
}
var createTemplate func(filenames ...string) *template.Template
@ -552,6 +553,11 @@ func setTxToTemplateData(td *TemplateData, tx *api.Tx) *TemplateData {
return td
}
// isOwnAddress returns true if the address is the one that is being shown in the explorer
func isOwnAddress(td *TemplateData, a string) bool {
return a == td.AddrStr
}
func (s *PublicServer) explorerTx(w http.ResponseWriter, r *http.Request) (tpl, *TemplateData, error) {
var tx *api.Tx
var err error