-
Notifications
You must be signed in to change notification settings - Fork 35
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
Transaction.getFee() returning 0.0 #82
Comments
Perhaps there is a difference between sent and received transactions. For received transactions, there is no way to calculate the fee, unless they had zero confirmations, and even then, maybe not. |
Oh, didn't see the comment. What's the best way to solve this problem in your opinion? Thanks @HashEngineering |
Since bitcoinj doesn't store the entire blockchain, it is not possible to determine the fee on received transactions without an external data source such as a block explorer or an electrum server. There is no p2p message (such as Transactions store the inputs, which are references to previous transactions, only with the transaction id and an index of the output. To determine the fee, bitcoinj would need to look back in the blockchain for that transaction and it would find the amount of coins that were in that input. bitcoinj does not store the blockchain and therefore cannot get the information of this input. There are some cases where bitcoinj can get the inputs:
|
@HashEngineering Thanks for the details! So basically the workarounds I see are:
|
I'm experiencing problems with the
tx.getFee()
method. Some times works fine but others just returns 0.0 when actually the fees are higher than that.I haven't been able to find a pattern with the transactions causing the issues. Some examples:
Any hypothesis about what could be causing the this random issue?
The text was updated successfully, but these errors were encountered: