Skip to content

Conversation

@acidbunny21
Copy link

@acidbunny21 acidbunny21 commented Jan 22, 2025

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

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)

@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

coveralls commented Jan 27, 2025

Pull Request Test Coverage Report for Build 20371746341

Details

  • 33 of 107 (30.84%) changed or added relevant lines in 3 files are covered.
  • 8 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-4.2%) to 86.428%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/api.rs 0 12 0.0%
src/async.rs 14 44 31.82%
src/blocking.rs 19 51 37.25%
Files with Coverage Reduction New Missed Lines %
src/async.rs 1 76.13%
src/blocking.rs 7 75.44%
Totals Coverage Status
Change from base Build 20348214326: -4.2%
Covered Lines: 1401
Relevant Lines: 1621

💛 - Coveralls

@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?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed, that'd be best.

Copy link
Author

Choose a reason for hiding this comment

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

i agree that would be best, but as I can see here, there is no enum defined for that field. I'd be happy to update that part as soon as it is upgraded to one there

Copy link
Collaborator

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

It could use a test with mempool/electrs implementation, while it's not available in blockstream/electrs and electrsd, as I've looked on the other PR and looks like it's following the same API.

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
Collaborator

Choose a reason for hiding this comment

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

Agreed, that'd be best.

@acidbunny21
Copy link
Author

It could use a test with mempool/electrs implementation, while it's not available in blockstream/electrs and electrsd, as I've looked on the other PR and looks like it's following the same API.

I'm okay with adding a test, but then we need to bump electrsd to 0.30 which introduce some breaking changes on bitcoind. Might be good to first bump it in a separated PR

@oleonardolima
Copy link
Collaborator

It could use a test with mempool/electrs implementation, while it's not available in blockstream/electrs and electrsd, as I've looked on the other PR and looks like it's following the same API.

I'm okay with adding a test, but then we need to bump electrsd to 0.30 which introduce some breaking changes on bitcoind. Might be good to first bump it in a separated PR

Yes, agree that it can be done in another PR. Another way that I thought was adding a test (under #[ignore]) that uses live mempool.space to test it, so we could run locally and in another step on CI while we don't have a new release on electrsd with the blockstream's esplora changes. However I think it's better to just wait until Blockstream/electrs#119 is release and just bump everything.

@acidbunny21
Copy link
Author

@oleonardolima it looks like the pipeline failures are caused by something unrelated with the PR, could you help please? :)

@oleonardolima
Copy link
Collaborator

@oleonardolima it looks like the pipeline failures are caused by something unrelated with the PR, could you help please? :)

It's caused due to recent native-tls release which bumped their MSRV to 1.80.0, it should be fine after #116 lands and a rebase should fix it.

@acidbunny21 acidbunny21 force-pushed the submit-tx-pkg-clients branch 2 times, most recently from c50be44 to 7886297 Compare March 1, 2025 07:45
@stevenroose
Copy link

stevenroose commented Mar 18, 2025

I think we uncovered a bug in here:

Reqwest(reqwest::Error { kind: Decode, source: Error("invalid type: floating point `0.0`, expected u64", line: 1, column: 230) })

I suspect it's in this field: pub base: Amount,. You should never use Amount's default deserialization. It has several options, but bitcoind does amounts as floating points:

#[serde(with = "amount::serde::as_btc")]
pub base: Amount,

the above should work

@acidbunny21 acidbunny21 force-pushed the submit-tx-pkg-clients branch 2 times, most recently from cb707fb to c0ed77e Compare March 18, 2025 17:25
@acidbunny21 acidbunny21 force-pushed the submit-tx-pkg-clients branch from c0ed77e to 1f1fa23 Compare April 23, 2025 11:35
@oleonardolima oleonardolima moved this to Needs Review in BDK Chain Aug 20, 2025
@oleonardolima
Copy link
Collaborator

@acidbunny21 Could you rebase and sign the commits on this one?

@acidbunny21 acidbunny21 force-pushed the submit-tx-pkg-clients branch from 1f1fa23 to 4719808 Compare August 23, 2025 06:50
Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

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

This needs a cargo fmt it seems

@acidbunny21
Copy link
Author

just ran cargo fmt and addressed your comments. Sorry for the delay

@ValuedMammal
Copy link
Contributor

Not sure why CI is being flaky.

@oleonardolima
Copy link
Collaborator

oleonardolima commented Sep 12, 2025

It's weird, running locally CI works just fine on master. I've tried to re-run CI steps without success.

@ValuedMammal ValuedMammal mentioned this pull request Sep 20, 2025
@tnull
Copy link
Contributor

tnull commented Oct 13, 2025

Any update here?

@ValuedMammal can we add this to the summit tag?

@ValuedMammal ValuedMammal added the summit Rust bitcoin summit label Oct 13, 2025
@acidbunny21
Copy link
Author

@tnull @ValuedMammal let me know if i can be of any help to have this merged

ValuedMammal added a commit that referenced this pull request Oct 27, 2025
9a7e826 fix(ci): pin dependencies to MSRV supported version (Leonardo Lima)

Pull request description:

  To fix the MSRV CI steps, the following dependencies
  needed to be pinned to a previous version:

  - `socket2@0.6.1` to 0.5.10
  - `webkpi-roots@1.0.3` to 1.0.1
  - `openssl` to 0.10.73
  - `openssl-sys` to 0.9.109
  - `syn` to 2.0.106

  I want to fix the CI so we can move forward with #114. After we cut a release with that one, we can move on to bumping the MSRV.

ACKs for top commit:
  ValuedMammal:
    ACK 9a7e826

Tree-SHA512: 4a13e03a1c66ba554926686149f5fc33ec926a11c94228a3402b87317c6e8958034483a04de84c072092c785de6229ff484da6ee8a3de33781788b5780139cb8
Copy link
Collaborator

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

It probably needs a rebase to get the MSRV fixes for CI. Also, you should fix the path when calling post_request method, as @ValuedMammal noted in #135.

@oleonardolima
Copy link
Collaborator

@acidbunny21 Is it okay if I take over this one? I want to move forward with this one and cut a release for rust-esplora-client, as I know @tnull has been looking forward to this.

@acidbunny21
Copy link
Author

@acidbunny21 Is it okay if I take over this one? I want to move forward with this one and cut a release for rust-esplora-client, as I know @tnull has been looking forward to this.

Yeah sure

@tnull
Copy link
Contributor

tnull commented Dec 15, 2025

It seems this branch is stale again by now and needs another rebase?

Copy link
Member

@luisschwab luisschwab left a comment

Choose a reason for hiding this comment

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

I didn't do any testing yet, but there's documentation missing on structs and missing trailing dots. Docs should follow the standard set on #147.

Copy link
Collaborator

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

tACK 7992b34

I've updated the example_wallet_esplora_blocking to build a zero-fee txA (v3), assert that it failed to relay due to expected: min relay fee not met, and did a CPFP with txB (v3) for the output and successfully submitted it as a package through the new API.

I've tested it for:

  • mempool.space API: I used testnet4 for syncing and submitting the package, see txA, and txB.

  • blockstream.info API: I used testnet3 (as testnet4 is not supported), though I had to use the mempool.space for syncing (due to blockstream rate limit issues), and only used blockstream.info API to try to broadcast the zero-fee and the submit package API, see txA and txB.

- adds new `submit_package` API to `AsyncClient` and `BlockingClient`,
  it has been added to esplora by `Blockstream/electrs#159`.
- adds new `SubmitPackageResult`, `TxResult` and
  `MempoolFeesSubmitPackage` API structures.
- changes the `post_request_hex` method to `post_request_bytes`,
  now handling `query_params` and having `Response` as return type.

BREAKING CHANGE: changes the `broadcast` method to return the `txid` for
broadcasted transaction, on both `AsyncClient` and `BlockingClient`.
Comment on lines +375 to +380
pub async fn broadcast(&self, transaction: &Transaction) -> Result<Txid, Error> {
let body = serialize::<Transaction>(transaction).to_lower_hex_string();
let response = self.post_request_bytes("/tx", body, None).await?;
let txid = Txid::from_str(&response.text().await?).map_err(|_| Error::InvalidResponse)?;
Ok(txid)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I just noticed that landing this PR has a breaking change, due to this change here and in the blocking client.

@tnull Do you need the submit_package API as a non-breaking release?

@oleonardolima
Copy link
Collaborator

I've squashed all changes into a single patch as they touched the same files, now d9f3868

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request summit Rust bitcoin summit

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

8 participants