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

feat(client): add async and blocking clients to submit txs package #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

acidbunny21
Copy link

@acidbunny21 acidbunny21 commented Jan 22, 2025

Counterpart PR for Blockstream/electrs#119 to enable submitpackage API

src/api.rs Outdated Show resolved Hide resolved
src/api.rs Outdated

#[derive(Deserialize, Debug)]
pub struct MempoolFeesSubmitPackage {
pub base: f64,

Choose a reason for hiding this comment

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

What is base here?
Can you leave a comment

src/async.rs Outdated Show resolved Hide resolved
src/blocking.rs Outdated Show resolved Hide resolved
Copy link

@stevenroose stevenroose left a comment

Choose a reason for hiding this comment

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

looks good, let just some nits. can confirm that the calls match the endpoint added in my pr on esplora (Blockstream/electrs#119)

src/blocking.rs Outdated Show resolved Hide resolved
src/blocking.rs Outdated Show resolved Hide resolved
src/blocking.rs Outdated Show resolved Hide resolved
@acidbunny21 acidbunny21 force-pushed the submit-tx-pkg-clients branch 2 times, most recently from 6a22216 to 01fb9c9 Compare January 23, 2025 13:41
@oleonardolima oleonardolima added the enhancement New feature or request label Jan 27, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 12930470174

Details

  • 20 of 84 (23.81%) changed or added relevant lines in 2 files are covered.
  • 8 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-4.4%) to 83.918%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/blocking.rs 20 48 41.67%
src/async.rs 0 36 0.0%
Files with Coverage Reduction New Missed Lines %
src/api.rs 1 53.03%
src/blocking.rs 7 72.47%
Totals Coverage Status
Change from base Build 12165803391: -4.4%
Covered Lines: 1148
Relevant Lines: 1368

💛 - Coveralls

Cargo.toml Outdated
@@ -18,6 +18,7 @@ path = "src/lib.rs"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we disable default features here and only enable the features we actually need?

Copy link
Author

Choose a reason for hiding this comment

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

done

src/api.rs Outdated

#[derive(Deserialize, Debug)]
pub struct TxResult {
pub txid: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's deserialize these into actual types, not String everywhere (see https://github.com/rust-bitcoin/corepc/blob/b62e8c84e3271e57b10849d27191c0357711660b/types/src/model/raw_transactions.rs#L17-L58 for examples).

Copy link
Author

Choose a reason for hiding this comment

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

updated. I also added the same comments on the fields as the ones in rust-bitcoin

src/async.rs Outdated
/// if `maxburnamount` is provided, any transaction
/// with higher provably unspendable outputs amount
/// will be rejected
pub async fn broadcast_package(
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets call this submit_package to avoid introducing a new separate terminology?

Copy link
Author

Choose a reason for hiding this comment

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

updated

@acidbunny21 acidbunny21 force-pushed the submit-tx-pkg-clients branch from 01fb9c9 to a5322c6 Compare January 29, 2025 08:34
pub struct SubmitPackageResult {
/// The transaction package result message. "success" indicates all transactions were accepted
/// into or are already in the mempool.
pub package_msg: String,
Copy link
Contributor

@tnull tnull Jan 29, 2025

Choose a reason for hiding this comment

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

Do we know if the variants here are finite? Do we see a chance to parse this into an enum?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants