Skip to content

Commit

Permalink
update labels to be more descriptive in duplicate checks, sort by in/…
Browse files Browse the repository at this point in the history
…out if time is same.
  • Loading branch information
papacarp committed Jun 11, 2018
1 parent 6b2d1e7 commit 0fd1561
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions explorer/explorerroutes.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ func (exp *explorerUI) AddressPage(w http.ResponseWriter, r *http.Request) {
}
// Funding transactions (unconfirmed)
var received, sent, numReceived, numSent int64
OUTERf:
FUNDING_TX_DUPLICATE_CHECK:
for _, f := range addressOuts.Outpoints {
//Mempool transactions stick around for 2 blocks. The first block
//incorporates the transaction and mines it. The second block
Expand All @@ -472,7 +472,7 @@ func (exp *explorerUI) AddressPage(w http.ResponseWriter, r *http.Request) {
//to not include those transactions in our list.
for _, b := range addrData.Transactions {
if f.Hash.String() == b.TxID && f.Index == b.InOutID {
continue OUTERf
continue FUNDING_TX_DUPLICATE_CHECK
}
}
fundingTx, ok := addressOuts.TxnsStore[f.Hash]
Expand Down Expand Up @@ -500,7 +500,7 @@ func (exp *explorerUI) AddressPage(w http.ResponseWriter, r *http.Request) {

}
// Spending transactions (unconfirmed)
OUTERs:
SPENDING_TX_DUPLICATE_CHECK:
for _, f := range addressOuts.PrevOuts {
//Mempool transactions stick around for 2 blocks. The first block
//incorporates the transaction and mines it. The second block
Expand All @@ -509,7 +509,7 @@ func (exp *explorerUI) AddressPage(w http.ResponseWriter, r *http.Request) {
//to not include those transactions in our list.
for _, b := range addrData.Transactions {
if f.TxSpending.String() == b.TxID && f.InputIndex == int(b.InOutID) {
continue OUTERs
continue SPENDING_TX_DUPLICATE_CHECK
}
}
spendingTx, ok := addressOuts.TxnsStore[f.TxSpending]
Expand Down Expand Up @@ -560,6 +560,9 @@ func (exp *explorerUI) AddressPage(w http.ResponseWriter, r *http.Request) {
}

sort.Slice(addrData.Transactions, func(i, j int) bool {
if addrData.Transactions[i].Time == addrData.Transactions[j].Time {
return addrData.Transactions[i].InOutID > addrData.Transactions[j].InOutID
}
return addrData.Transactions[i].Time > addrData.Transactions[j].Time
})

Expand Down

0 comments on commit 0fd1561

Please sign in to comment.