You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we do a batch request where the response array contains a response object which is an error, ElectrumClient will return Err(Error::Protocol) and the response objects will be discarded. This is not ideal as in most instances, we still want the response objects.
For example, a single request to method blockchain.transaction.get may return an response object with error if the transaction does not exist. Doing a batch of blockchain.transaction.get requests where we have a single transaction that the electrum server is not aware of (yet), will result in us not seeing any of the other response objects.
fnbatch_call(&self,batch:&Batch) -> Result<Vec<RawResponse>,Error>{todo!()}pubenumRawResponse{/// Instead of returning `Err(Error::Protocol)`, we have this.Error{code:i32,message:String,data:Option<serde::Value>},/// The successful result, as usual.Result(serde::Value),}
The RawResponse can be used to transform into a non-raw response depending on the method invoked.
For example, client.transaction_get() can return Result<Option<Transaction>, Error>.
Questions
The electrum server API docs does not provide error codes for error responses. Is there a standard for these? For example, if a transaction is not found.
The problem
If we do a batch request where the response array contains a response object which is an error,
ElectrumClient
will returnErr(Error::Protocol)
and the response objects will be discarded. This is not ideal as in most instances, we still want the response objects.For example, a single request to method
blockchain.transaction.get
may return an response object with error if the transaction does not exist. Doing a batch ofblockchain.transaction.get
requests where we have a single transaction that the electrum server is not aware of (yet), will result in us not seeing any of the other response objects.This is the current API for a batch request
rust-electrum-client/src/raw_client.rs
Line 697 in 1290819
Proposed solution
The
RawResponse
can be used to transform into a non-raw response depending on the method invoked.For example,
client.transaction_get()
can returnResult<Option<Transaction>, Error>
.Questions
Reference
The text was updated successfully, but these errors were encountered: