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

relay_fee result should be strongly typed #164

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

Conversation

rustaceanrob
Copy link

From the docs:

Returns the minimum accepted fee by the server’s node in Bitcoin, not Satoshi.

That last nuance is irrelevant if the API just returns the Amount type. Same thing should be done for estimate_fee to use FeeRate, but that one is non-trivial.

@@ -879,17 +879,18 @@ impl<T: Read + Write> ElectrumApi for RawClient<T> {
.ok_or_else(|| Error::InvalidResponse(result.clone()))
}

fn relay_fee(&self) -> Result<f64, Error> {
fn relay_fee(&self) -> Result<Amount, Error> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know the docs aren't clear in this regard but I think it would make sense for this to return a FeeRate which I believe was the approach in #136 also.

Copy link
Author

@rustaceanrob rustaceanrob Feb 9, 2025

Choose a reason for hiding this comment

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

I don't know the electrum protocol, my interpretation of the docs was this is an absolute fee that a transaction must have, so an Amount is the fee required to broadcast with that node.

If this is actually a fee rate in bitcoin per vbyte then the docs should be updated accordingly before any attempt at a PR to return FeeRate

Copy link
Collaborator

Choose a reason for hiding this comment

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

I also interpret the docs as this one being an absolute fee, but some validation on electrum code besides documentation is needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear I'm referring to "relay fee" as described in getnetworkinfo RPC if indeed that's what this method refers to. https://bitcoincore.org/en/doc/28.0.0/rpc/network/getnetworkinfo/

I agree that the value can be parsed as an amount in BTC (same for estimate_fee), but that still leaves #136 unresolved where the user has to interpret the value as a useful feerate.

this is an absolute fee that a transaction must have, so an Amount is the fee required to broadcast with that node

If you consider test_relay_fee below, that would be saying that the blockstream server refuses to relay anything that pays less than 1000 sats in fees which I don't think is the case.

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