Skip to content

Commit 4ec17d9

Browse files
review changes: Make /mempool tx col match /blocks tx col
Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
1 parent f071bc3 commit 4ec17d9

4 files changed

Lines changed: 14 additions & 11 deletions

File tree

cmd/dcrdata/views/mempool.tmpl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@
231231
<tr>
232232
<th>Transaction ID</th>
233233
<th class="text-end">Total DCR</th>
234-
<th class="text-end">Size</th>
235234
<th class="text-end">Fee Rate</th>
235+
<th class="text-end">Size</th>
236236
<th class="text-end">Time in Mempool</th>
237237
</tr>
238238
</thead>
@@ -247,8 +247,8 @@
247247
<td class="mono fs15 text-end">
248248
{{template "decimalParts" (float64AsDecimalParts .TotalOut 8 false)}}
249249
</td>
250-
<td class="mono fs15 text-end">{{.Size}} B</td>
251250
<td class="mono fs15 text-end">{{printf "%.8f" (.FeeRate)}} DCR/kB</td>
251+
<td class="mono fs15 text-end">{{.Size}} B</td>
252252
<td class="mono fs15 text-end" data-time-target="age" data-age="{{.Time}}"></td>
253253
</tr>
254254
{{- end -}}
@@ -307,8 +307,9 @@
307307
<tr>
308308
<th>Transaction ID</th>
309309
<th class="text-end">Total DCR</th>
310-
<th class="text-end">Size</th>
310+
<th class="text-end">Fee</th>
311311
<th class="text-end">Fee Rate</th>
312+
<th class="text-end">Size</th>
312313
<th class="text-end">Time in Mempool</th>
313314
</tr>
314315
</thead>
@@ -323,8 +324,9 @@
323324
<td class="mono fs15 text-end">
324325
{{template "decimalParts" (float64AsDecimalParts .TotalOut 8 false)}}
325326
</td>
327+
<td class="mono fs15 text-end">{{.Fee}}</td>
328+
<td class="mono fs15 text-end">{{dcrPerKbToAtomsPerByte .FeeRate}} atoms/B</td>
326329
<td class="mono fs15 text-end">{{.Size}} B</td>
327-
<td class="mono fs15 text-end">{{printf "%.8f" (.FeeRate)}} DCR/kB</td>
328330
<td class="mono fs15 text-end" data-time-target="age" data-age="{{.Time}}"></td>
329331
</tr>
330332
{{- end -}}

explorer/types/explorertypes.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -988,12 +988,11 @@ type TicketPoolInfo struct {
988988

989989
// MempoolTx models the tx basic data for the mempool page
990990
type MempoolTx struct {
991-
TxID string `json:"txid"`
992-
Version int32 `json:"version"`
993-
Fees float64 `json:"fees"`
994-
FeeRate float64 `json:"fee_rate"`
995-
// Consider atom representation:
996-
//FeeAmount int64 `json:"fee_amount"`
991+
TxID string `json:"txid"`
992+
Version int32 `json:"version"`
993+
Fee dcrutil.Amount `json:"fee"`
994+
Fees float64 `json:"fees"`
995+
FeeRate float64 `json:"fee_rate"`
997996
VinCount int `json:"vin_count"`
998997
VoutCount int `json:"vout_count"`
999998
Vin []MempoolInput `json:"vin,omitempty"`

mempool/collector.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,13 @@ func (t *DataCollector) mempoolTxns() ([]exptypes.MempoolTx, txhelpers.MempoolAd
135135
//fee, _ := txhelpers.TxFeeRate(msgTx)
136136
// log.Tracef("tx fee: GRM result = %f, msgTx = %f", tx.Fee, fee.ToCoin())
137137

138-
_, feeRate := txhelpers.TxFeeRate(msgTx)
138+
fee, feeRate := txhelpers.TxFeeRate(msgTx)
139139

140140
txs = append(txs, exptypes.MempoolTx{
141141
TxID: hashStr,
142142
Version: int32(msgTx.Version),
143143
Fees: tx.Fee,
144+
Fee: fee,
144145
FeeRate: feeRate.ToCoin(),
145146
VinCount: len(msgTx.TxIn),
146147
VoutCount: len(msgTx.TxOut),

mempool/monitor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ func (p *MempoolMonitor) TxHandler(rawTx *chainjson.TxRawResult) error {
244244
tx := exptypes.MempoolTx{
245245
TxID: hash,
246246
Version: rawTx.Version,
247+
Fee: fee,
247248
Fees: fee.ToCoin(),
248249
FeeRate: feeRate.ToCoin(),
249250
VinCount: len(msgTx.TxIn),

0 commit comments

Comments
 (0)