mschneider / solcpp

A fast Solana and Mango Markets C++ SDK
Other
39 stars 12 forks source link

Confirmtransaction Implementation (#44) #57

Closed Lioncat2002 closed 1 year ago

Lioncat2002 commented 1 year ago

Updated branch showing the latest commits

Lioncat2002 commented 1 year ago

There seems to some some problem with the number of commits that are showing but the files changed are appearing correctly

alexeyneu commented 1 year ago

this is how not to do it really https://github.com/mschneider/solcpp/pull/57/files#diff-b5be9bf0b275184a7783989d8fceb834cadb7ee3d9e2cccbef0d54b73e9b7622R500-R513

https://github.com/mschneider/solcpp/blob/5e75eef51dcc6553d8af0080290df56824e36b2b/lib/solana.cpp#L500-L512

mschneider commented 1 year ago

There seems to some some problem with the number of commits that are showing but the files changed are appearing correctly

previous branch was squashed and rebased. when you merge it back to your branch it will cause a lot of merge conflicts, that you will need to manually resolve. it's in this case not trivially mergeable. rebase & cherry-pick are good tools in a situation like this one

Lioncat2002 commented 1 year ago

Ahhh I see I will make the changes and open a new PR

Lioncat2002 commented 1 year ago

this is how not to do it really https://github.com/mschneider/solcpp/pull/57/files#diff-b5be9bf0b275184a7783989d8fceb834cadb7ee3d9e2cccbef0d54b73e9b7622R500-R513

https://github.com/mschneider/solcpp/blob/5e75eef51dcc6553d8af0080290df56824e36b2b/lib/solana.cpp#L500-L512

Emm how would you suggest making the changes? I wrote it according to the option c that @mschneider mentioned here https://github.com/mschneider/solcpp/issues/44#issuecomment-1274558062

alexeyneu commented 1 year ago

see you've been more or less answered in the other pr discussion. Wanna add that you do not need wait op here because all these functions are blocking ones. So when it returns means you can call another one.

waiting stuff: https://github.com/alexeyneu/solcpp/blob/bc6bf842bfb85f274527163496042b0430cf3f82/examples/placeOrder.cpp#L255-L256

std::mutex com_mp;            // wait lock
std::condition_variable li;
std::atomic<bool> tro;

 do {

    std::unique_lock<std::mutex> lk(com_mp);
    li.wait_for(lk , std::chrono::milliseconds(17000) , [] { return tro == !false; });
 } while(tro == false);