-
Notifications
You must be signed in to change notification settings - Fork 64
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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> { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
From the docs:
That last nuance is irrelevant if the API just returns the
Amount
type. Same thing should be done forestimate_fee
to useFeeRate
, but that one is non-trivial.