-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
ethclient: BlockByNumber cannot handle pending
block
#25537
Comments
pending
block
Yeah this is a wart in our API, it seems. cc @fjl any thoughts? |
pending
blockpending
block
This is any way to fix that now? or waiting to new commit? |
I sort of think
Working towards removing |
Sometimes transactions are always pending because of wrong parameters, I get them through “pending”; do you have any other ways to recommend? |
@757566833, the comment by @lightclient is about possibly changing the RPC specification in the future. At the current time the "pending" block is supported and you can use it. |
We have |
About this issue: the request is failing because the |
BTW, it's a bad idea to use the pending block for getting transactions. The block will only return a limited number of txs, and are chosen by the go-ethereum mining algorithm, which is not guaranteed to match the next block. So you will miss some transactions when using this method. |
It seems like 3 ways to resolve this issue:
Any other ideas? |
Note: at the moment, |
@fjl ah okay! In that case would it not be best to just return error that it isn't supported if someone sends |
i just see in expected behaviour fieild 'from' in transactions list. I need this field but i cant find this in other methods, and sometimes subscribe to pending tx (SubscribePendingTransactions) return us nil, in this case we skip some transaction? Mb i need tx_pool content but i cant receive list of txs in this method, couz i just weak in golang, cant understand how use this method |
@lightclient we kind of do. The error we return is |
@criogennn Your use case, where transactions sent be |
We will not add support for retrieving the complete pending block in ethclient. It doesn't make sense, the pending block will change all the time and is not a reliable source of information. |
Although the result is the same, an error is returned to the caller, I think the error message as-is is not fair to the caller. |
System information
Geth version: ethereum/client-go:alltools-v1.10.20
OS & Version:Linux
github.com/ethereum/go-ethereum v1.10.20
Expected behaviour
unmarshal
Actual behaviour
cannot unmarshal
Steps to reproduce the behaviour
Backtrace
When submitting logs: please submit them as text and not screenshots.
json: cannot unmarshal non-string into Go struct field rpcBlock.hash of type common.Hash
i want to get pending tx by ethclient
raw
but body (rpcblock)
The text was updated successfully, but these errors were encountered: