-
Notifications
You must be signed in to change notification settings - Fork 341
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
In the confirm_transaction() if you pass an old blockheight (that's older than the current blockheight), the while loop does not enter so resp never gets assigned.
The else statement should in this case raise TransactionExpiredBlockheightExceededError but instead raises UnboundLocalError: cannot access local variable 'resp' where it is not associated with a value.
solana-py/src/solana/rpc/api.py
Line 1109 in 72d3cc6
| if isinstance(resp, RPCError.__args__): # type: ignore |
if last_valid_block_height: # pylint: disable=no-else-return
current_blockheight = (self.get_block_height(commitment)).value
# FIX
if current_blockheight > last_valid_block_height:
raise TransactionExpiredBlockheightExceededError(f"{tx_sig} has expired: block height exceeded")
# /FIX
while current_blockheight <= last_valid_block_height:
resp = self.get_signature_statuses([tx_sig]) # <-- never gets here
if isinstance(resp, RPCError.__args__): # type: ignore
raise RPCException(resp)
resp_value = resp.value[0]
if resp_value is not None:
confirmation_status = resp_value.confirmation_status
if confirmation_status is not None:
confirmation_rank = int(confirmation_status)
if confirmation_rank >= commitment_rank:
break
current_blockheight = (self.get_block_height(commitment)).value
sleep(sleep_seconds)
else:
if isinstance(resp, RPCError.__args__):
raise RPCException(resp)
raise TransactionExpiredBlockheightExceededError(f"{tx_sig} has expired: block height exceeded")
return respMetadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed