Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add list transactions command to the wallet #1527

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

OBorce
Copy link
Contributor

@OBorce OBorce commented Feb 1, 2024

new wallet command to list the confirmed transactions, with an optional filter based on address, and a limit

@@ -351,6 +351,29 @@ impl<N: NodeInterface + Clone + Send + Sync + 'static> WalletRpc<N> {
.await?
}

pub async fn confirmed_transactions(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word "confirmed" is very dangerous to use. We still haven't formalized what "confirmed" really means. In bitcoin, confirmation depends on the number of blocks stacked above the block where the transaction resides. You'll notice also that "confirmed" always comes accompanied with a parameter "depth" or "number of confirmation", as a filter, exactly for this reason.

For us, it's much more complicated and there's a fair amount of math involved to decide what a "confirmed" transaction really is.

I would feel more comfortable calling this mainchain_transactions, because that doesn't give any sense of "confirmed". We can go back to the problem of "confirmations" later.

@@ -650,6 +650,16 @@ pub enum WalletCommand {
#[clap(name = "transaction-list-pending")]
ListPendingTransactions,

/// List confirmed transactions with optional address filter
#[clap(name = "transaction-list-confirmed")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transaction-list-by-address

destination: Option<Destination>,
limit: usize,
) -> Vec<WithId<&Transaction>> {
self.txs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to order these transactions in descending order, from newest to oldest?

@OBorce OBorce force-pushed the feature/wallet-list-transactions branch from 5621d72 to 26b6ae8 Compare February 2, 2024 15:31
#[rstest]
#[trace]
#[case(Seed::from_entropy())]
fn wallet_list_confirmed_transactions(#[case] seed: Seed) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name

Copy link
Contributor

@TheQuantumPhysicist TheQuantumPhysicist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the minor comment, good to go.

@OBorce OBorce force-pushed the feature/wallet-list-transactions branch from 26b6ae8 to 069919b Compare February 3, 2024 20:21
@OBorce OBorce merged commit fdd9b51 into master Feb 6, 2024
17 checks passed
@OBorce OBorce deleted the feature/wallet-list-transactions branch February 6, 2024 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants