-
Notifications
You must be signed in to change notification settings - Fork 24
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
Replaced rc by arc in daemon #308
Conversation
Codecov ReportAttention:
Additional details and impacted files
|
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.
Nice! What's the use-case you're going for?
Although you could get into trouble with this... I think you need to use With |
It's for use with an axum server ! Using the daemon to be able to query chain information and depending on the arriving transactions, give a fee grant to the user for on-boarding the chain. I'm wrapping my Daemon inside a Mutex to avoid simultaneous mutations |
In that case it would still be better to wrap the required types internally. The type should be safe to use as-is. |
Will update with Mutex then ! |
How does it handle it automatically? The account sequence is only incremented once a tx is included in a new block so an attept to put multiple txs into the same block will fail. |
There's a retry strategy but that's highly inefficient. |
Because the Mutex is around the Daemon, it will only unlock it when the transaction has been included in a block (after awaiting the tx), ie after the next block, so the account sequence is updated and everything works prefectly |
If you do it around the daemon sure but then what's the benefit to having it multi-threaded if you can't execute txs in parallel? You could include the account seq in the Sender object itself and have it incremented on every submitted tx. Then you don't need to lock the whole daemon object while waiting for a response. |
Actually I think it's not the Sender that needs to be Mutex it's only the sender's account sequence. |
This PR aims at replacing RC by ARC to be able to send a daemon between threads