This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix asynchronous transaction rejections. #3817
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bkchr
approved these changes
Oct 14, 2019
core/rpc/src/author/tests.rs
Outdated
@@ -31,6 +31,9 @@ use test_client::{ | |||
self, AccountKeyring, runtime::{Extrinsic, Transfer, SessionKeys}, DefaultTestClientBuilderExt, | |||
TestClientBuilderExt, | |||
}; | |||
use rpc::futures::{ |
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.
The curly braces can be removed.
core/rpc/src/author/tests.rs
Outdated
subscriptions: Subscriptions::new(Arc::new(runtime.executor())), | ||
keystore: keystore.clone(), | ||
}; | ||
let (subscriber, id_rx, _data) = ::jsonrpc_pubsub::typed::Subscriber::new_test("test"); |
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.
Suggested change
let (subscriber, id_rx, _data) = ::jsonrpc_pubsub::typed::Subscriber::new_test("test"); | |
let (subscriber, id_rx, _data) = jsonrpc_pubsub::typed::Subscriber::new_test("test"); |
core/rpc/src/author/mod.rs
Outdated
.map(|res| res.map_err(|e| | ||
e.into_pool_error() | ||
.map(error::Error::from) | ||
.unwrap_or_else(|e| error::Error::Verification(Box::new(e)).into()) |
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.
Why don't we use a second map_err
here?
We could also just make one map_err
that outputs the correct error directly.
Tested this branch, and it fixes the issue, actual RPC outputs with a previous failure -
(Previously, as well as on Kusama, used to get a subscription id back, not the actual error) |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before #3650 the transactions were imported to the pool in a synchronous manner,. Because of that it was simple for
submit_and_watch_extrinsic
subscription to return an error if the transaction was rejected, instead of starting the subscription.The async refactoring missed one case that handles the asynchronous verification in the pool - errors in that verification only lead to a warning and the subscription was started anyway, but never produced any message.
This PR fixes this behavior. CC @jacogr