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
.help("Return signature immediately after submitting the transaction, instead of waiting for confirmations"),
Given the above description, the expected behavior is to return the transaction signature immediately after sending the transaction.
Reproduction
The easiest way to reproduce this locally is to change the default commitment to finalized before running the command. In ~/.config/solana/cli/config.yml:
# ...commitment: finalized
Details
After a long chain of calls, the command processor eventually calls the token.process_ixs, which then calls client.send_transaction:
Thus, the send method both sends and confirms the transaction.
This also makes the spinner for confirming transactions never show up because the transaction has to be confirmed beforehand for that part of the code to execute.
Additionally, pretty much all commands seem to be calling the finish_tx function with no_wait argument as false, which means they're confirming the transaction twice:
The simplest solution would be to change the client.send_and_confirm_transaction call to client.send_transaction, especially since the transactions are already being confirmed inside the finish_tx function as mentioned earlier.
However, this would affect people who use the spl-token-client and expect the methods of Token to confirm transactions. For example, it may break local testing, including the tests in this repository. Considering this, an improved version of this solution would be to convert the ProgramRpcClientSendTransaction struct to a named one and add a confirm field to decide whether to also confirm the transaction inside its SendTransactionRpc implementation.
Another solution would be to:
Rename ProgramRpcClientSendTransaction to ProgramRpcClientSendAndConfirmTransaction
Add ProgramRpcClientSendTransaction that only sends the transaction in its SendTransactionRpc::send method
as mentioned in #3139 (review), but a downside of this solution is that it requires quite a bit more changes than the previous solution.
The text was updated successfully, but these errors were encountered:
Problem
Running the
transfer
command with the--no-wait
flag still waits for transaction confirmation.solana-program-library/token/cli/src/clap_app.rs
Lines 1401 to 1404 in 9d467db
Given the above description, the expected behavior is to return the transaction signature immediately after sending the transaction.
Reproduction
The easiest way to reproduce this locally is to change the default commitment to
finalized
before running the command. In~/.config/solana/cli/config.yml
:Details
After a long chain of calls, the command processor eventually calls the
token.process_ixs
, which then callsclient.send_transaction
:solana-program-library/token/client/src/token.rs
Lines 726 to 727 in 9d467db
Later, this method eventually calls
<ProgramRpcClientSendTransaction as SendTransactionRpc>::send
, which actually callsclient.send_and_confirm_transaction
:solana-program-library/token/client/src/client.rs
Lines 147 to 148 in 9d467db
Thus, the
send
method both sends and confirms the transaction.This also makes the spinner for confirming transactions never show up because the transaction has to be confirmed beforehand for that part of the code to execute.
Additionally, pretty much all commands seem to be calling the
finish_tx
function withno_wait
argument asfalse
, which means they're confirming the transaction twice:solana-program-library/token/cli/src/command.rs
Lines 4714 to 4728 in 9d467db
And if the user passes in
--no-wait
, then the transaction would only get confirmed once (during the initialsend_and_confirm
):solana-program-library/token/cli/src/command.rs
Lines 4709 to 4713 in 9d467db
Solution
The simplest solution would be to change the
client.send_and_confirm_transaction
call toclient.send_transaction
, especially since the transactions are already being confirmed inside thefinish_tx
function as mentioned earlier.However, this would affect people who use the
spl-token-client
and expect the methods ofToken
to confirm transactions. For example, it may break local testing, including the tests in this repository. Considering this, an improved version of this solution would be to convert theProgramRpcClientSendTransaction
struct to a named one and add aconfirm
field to decide whether to also confirm the transaction inside itsSendTransactionRpc
implementation.Another solution would be to:
ProgramRpcClientSendTransaction
toProgramRpcClientSendAndConfirmTransaction
ProgramRpcClientSendTransaction
that only sends the transaction in itsSendTransactionRpc::send
methodas mentioned in #3139 (review), but a downside of this solution is that it requires quite a bit more changes than the previous solution.
The text was updated successfully, but these errors were encountered: