mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-23 17:47:29 +00:00
rpc: reverse the order of listtransactions to align with lbrycrd
This commit is contained in:
parent
610ec20ea8
commit
46f4df5a64
1 changed files with 6 additions and 8 deletions
|
@ -2093,13 +2093,9 @@ func (w *Wallet) ListTransactions(from, count int) ([]btcjson.ListTransactionsRe
|
||||||
// include the next count transactions.
|
// include the next count transactions.
|
||||||
skipped := 0
|
skipped := 0
|
||||||
n := 0
|
n := 0
|
||||||
|
|
||||||
rangeFn := func(details []wtxmgr.TxDetails) (bool, error) {
|
rangeFn := func(details []wtxmgr.TxDetails) (bool, error) {
|
||||||
// Iterate over transactions at this height in reverse order.
|
|
||||||
// This does nothing for unmined transactions, which are
|
for _, detail := range details {
|
||||||
// unsorted, but it will process mined transactions in the
|
|
||||||
// reverse order they were marked mined.
|
|
||||||
for i := len(details) - 1; i >= 0; i-- {
|
|
||||||
if from > skipped {
|
if from > skipped {
|
||||||
skipped++
|
skipped++
|
||||||
continue
|
continue
|
||||||
|
@ -2110,7 +2106,7 @@ func (w *Wallet) ListTransactions(from, count int) ([]btcjson.ListTransactionsRe
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonResults := listTransactions(tx, &details[i],
|
jsonResults := listTransactions(tx, &detail,
|
||||||
w.Manager, syncBlock.Height, w.chainParams)
|
w.Manager, syncBlock.Height, w.chainParams)
|
||||||
txList = append(txList, jsonResults...)
|
txList = append(txList, jsonResults...)
|
||||||
|
|
||||||
|
@ -2124,8 +2120,10 @@ func (w *Wallet) ListTransactions(from, count int) ([]btcjson.ListTransactionsRe
|
||||||
|
|
||||||
// Return newer results first by starting at mempool height and working
|
// Return newer results first by starting at mempool height and working
|
||||||
// down to the genesis block.
|
// down to the genesis block.
|
||||||
return w.TxStore.RangeTransactions(txmgrNs, -1, 0, rangeFn)
|
// return w.TxStore.RangeTransactions(txmgrNs, -1, 0, rangeFn)
|
||||||
|
return w.TxStore.RangeTransactions(txmgrNs, 0, -1, rangeFn)
|
||||||
})
|
})
|
||||||
|
|
||||||
return txList, err
|
return txList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue