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

Bulk txs outspends #36

Merged
merged 2 commits into from
Sep 17, 2023
Merged

Bulk txs outspends #36

merged 2 commits into from
Sep 17, 2023

Conversation

mononaut
Copy link
Contributor

This PR adds a new bulk outspends endpoint at GET /txs/outspends, which takes a comma-separated list of up to 50 txids in the ?txids query param, and returns a nested list of outspends.

The response matches the format of the equivalent /api/v1/outspends API endpoint in the mempool backend, and provides an easy and more efficient replacement for that API call.

Note that the query param format is slightly different -- comma-separated values instead of php-style foo[]=bar array syntax -- since the latter is awkward to parse.

Copy link
Member

@wiz wiz left a comment

Choose a reason for hiding this comment

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

Tested ACK @ mempool-electrs 3.0.0-dev-3858f5a

Copy link
Member

@junderw junderw left a comment

Choose a reason for hiding this comment

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

We should do something about the path naming convention and implement whitelisting in nginx conf
(Same response as #33 )

Otherwise LGTM

@wiz
Copy link
Member

wiz commented Aug 16, 2023

Okay but we can rename all the APIs in a separate PR that adds the nginx stuff

@junderw
Copy link
Member

junderw commented Aug 16, 2023

Sure.

@junderw
Copy link
Member

junderw commented Aug 27, 2023

See mempool/mempool#4158 (comment)

Change internal API root to internal

@junderw
Copy link
Member

junderw commented Sep 17, 2023

@mononaut Are you going to change this to /internal as well?

@mononaut
Copy link
Contributor Author

no, this is the endpoint we want to use in the front end, so it needs to stay publicly accessible.

it should be safe enough though, since it's capped at 50 txids per request and fails fast above that (and it'll replace a proxied nodejs endpoint that currently unrolls into 50 separate electrs /outspend requests)

Copy link
Member

@softsimon softsimon left a comment

Choose a reason for hiding this comment

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

tested ACK @ [3f877ad]

Augmented the frontend to use /api/txs/outspends and it works as expected.

@softsimon softsimon merged commit 333ad87 into mempool Sep 17, 2023
@softsimon softsimon deleted the mononaut/batch-outspends branch September 17, 2023 16:19
SatoKentaNayoro pushed a commit to boolnetwork/mempool-electrs that referenced this pull request Nov 29, 2024
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.

4 participants