solana-py
solana-py copied to clipboard
Any way to use send_transaction() reliably?
I have a lot of problems with send_transaction(), in that I get a lot of timeouts. The errors look like this.
Traceback (most recent call last):
File "/home/vmware/b.py", line 49, in <module>
client.send_transaction(
File "/home/vmware/.local/lib/python3.10/site-packages/solana/rpc/api.py", line 1067, in send_transaction
txn_resp = self.send_raw_transaction(txn.serialize(), opts=opts_to_use)
File "/home/vmware/.local/lib/python3.10/site-packages/solana/rpc/api.py", line 996, in send_raw_transaction
return self.__post_send_with_confirm(*post_send_args)
File "/home/vmware/.local/lib/python3.10/site-packages/solana/rpc/api.py", line 1124, in __post_send_with_confirm
self.confirm_transaction(sig, conf_comm, last_valid_block_height=last_valid_block_height)
File "/home/vmware/.local/lib/python3.10/site-packages/solana/rpc/api.py", line 1177, in confirm_transaction
raise UnconfirmedTxError(f"Unable to confirm transaction {tx_sig}")
solana.rpc.core.UnconfirmedTxError: Unable to confirm transaction 62CZWwK9CPhkPGWXJYs6dLZ3hUty9Dja6hVy7t5YRzYySFdxjPgYnXmUeWcijuGYfR3Pt889wnacaUVFVwTks9Ce
Since I want to use this to send to many addresses and reliability is needed, what can I do to prevent these 'Unable to confirm transaction' errors?
This is the line that I use to send the transaction:
client.send_transaction(
transaction,
lawrenceprivate_keysol,
opts = TxOpts(
skip_confirmation = False,
preflight_commitment = Confirmed
)
)