mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-23 17:47:29 +00:00
multi-account: update listalltransactions
This commit is contained in:
parent
2e8dcc4312
commit
1edb90e0aa
2 changed files with 5 additions and 10 deletions
|
@ -1526,16 +1526,10 @@ func listAddressTransactions(icmd interface{}, w *wallet.Wallet) (interface{}, e
|
||||||
// similar to ListTransactions, except it takes only a single optional
|
// similar to ListTransactions, except it takes only a single optional
|
||||||
// argument for the account name and replies with all transactions.
|
// argument for the account name and replies with all transactions.
|
||||||
func listAllTransactions(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
|
func listAllTransactions(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
|
||||||
|
|
||||||
cmd := icmd.(*btcjson.ListAllTransactionsCmd)
|
cmd := icmd.(*btcjson.ListAllTransactionsCmd)
|
||||||
|
|
||||||
if cmd.Account != nil && *cmd.Account != "*" {
|
return w.ListAllTransactions(*cmd.Account)
|
||||||
return nil, &btcjson.RPCError{
|
|
||||||
Code: btcjson.ErrRPCInvalidParameter,
|
|
||||||
Message: "Listing all transactions may only be done for all accounts",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return w.ListAllTransactions()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// listUnspent handles the listunspent command.
|
// listUnspent handles the listunspent command.
|
||||||
|
|
|
@ -2172,7 +2172,7 @@ func (w *Wallet) ListAddressTransactions(pkHashes map[string]struct{}) ([]btcjso
|
||||||
// ListAllTransactions returns a slice of objects with details about a recorded
|
// ListAllTransactions returns a slice of objects with details about a recorded
|
||||||
// transaction. This is intended to be used for listalltransactions RPC
|
// transaction. This is intended to be used for listalltransactions RPC
|
||||||
// replies.
|
// replies.
|
||||||
func (w *Wallet) ListAllTransactions() ([]btcjson.ListTransactionsResult, error) {
|
func (w *Wallet) ListAllTransactions(accountName string) ([]btcjson.ListTransactionsResult, error) {
|
||||||
txList := []btcjson.ListTransactionsResult{}
|
txList := []btcjson.ListTransactionsResult{}
|
||||||
err := walletdb.View(w.db, func(tx walletdb.ReadTx) error {
|
err := walletdb.View(w.db, func(tx walletdb.ReadTx) error {
|
||||||
txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey)
|
txmgrNs := tx.ReadBucket(wtxmgrNamespaceKey)
|
||||||
|
@ -2187,7 +2187,8 @@ func (w *Wallet) ListAllTransactions() ([]btcjson.ListTransactionsResult, error)
|
||||||
// unsorted, but it will process mined transactions in the
|
// unsorted, but it will process mined transactions in the
|
||||||
// reverse order they were marked mined.
|
// reverse order they were marked mined.
|
||||||
for i := len(details) - 1; i >= 0; i-- {
|
for i := len(details) - 1; i >= 0; i-- {
|
||||||
jsonResults := listTransactions(tx, &details[i], w.Manager,
|
jsonResults := listTransactions(accountName,
|
||||||
|
tx, &details[i], w.Manager,
|
||||||
syncBlock.Height, w.chainParams)
|
syncBlock.Height, w.chainParams)
|
||||||
txList = append(txList, jsonResults...)
|
txList = append(txList, jsonResults...)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue