Open esolskjaer opened 4 weeks ago
After a lot of digging, I've found the root of the problem. Implemented a tentative solution here https://github.com/coral-xyz/anchor/pull/3006, but I think it still needs some work. I propose moving further discussion there.
I'm trying to invoke a transaction with
anchor_client
from a tokio context. Here's how I'm doing it:Unfortunately this gives me the error
What I've tried:
Rc
to anArc
async
toasync move
tokio::spawn
The best approach as of now is to just create the Signer in each thread separately, instead of having a single signer being used across threads.
, but I couldn't really figure out how to change my code accordingly.This MRE is based on https://github.com/coral-xyz/anchor/blob/master/client/example/src/nonblocking.rs btw. The only change I made was adding
tokio::spawn
(since I need this in my own code) and enabling theasync
feature foranchor_client
. Here's my fork with the mentioned changes: Just pushed an MRE for my issue here btw: https://github.com/esolskjaer/anchor/blob/master/client/example/src/nonblocking.rs#L65-L98Any idea on how to fix this?