Skip to content

Commit 5b33d38

Browse files
authored
refactor: AssembledTransaction.simulate and AssembledTransactionAsync.simulate will no longer restore the state for read-only transactions. (#1026)
1 parent b5b6698 commit 5b33d38

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Release History
55

66
#### Update
77
- feat: add `TransactionBuilder.append_payment_to_contract_op` and `TransactionBuilder.append_restore_asset_balance_entry_op` to send assets to contract accounts without relying on Stellar RPC. ([#1023](https://github.com/StellarCN/py-stellar-base/pull/1023))
8+
- refactor: `AssembledTransaction.simulate` and `AssembledTransactionAsync.simulate` will no longer restore the state for read-only transactions. ([#1026](https://github.com/StellarCN/py-stellar-base/pull/1026))
89

910
### Version 12.1.0
1011

stellar_sdk/contract/assembled_transaction.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def simulate(self, restore: bool = True) -> "AssembledTransaction":
8888
built_tx = self.transaction_builder.build()
8989
self.simulation = self.server.simulate_transaction(built_tx)
9090

91-
if restore and self.simulation.restore_preamble:
91+
if restore and self.simulation.restore_preamble and not self.is_read_call():
9292
try:
9393
self.restore_footprint(self.simulation.restore_preamble)
9494
except (

stellar_sdk/contract/assembled_transaction_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async def simulate(self, restore: bool = True) -> "AssembledTransactionAsync":
8888
built_tx = self.transaction_builder.build()
8989
self.simulation = await self.server.simulate_transaction(built_tx)
9090

91-
if restore and self.simulation.restore_preamble:
91+
if restore and self.simulation.restore_preamble and not self.is_read_call():
9292
try:
9393
await self.restore_footprint(self.simulation.restore_preamble)
9494
except (

0 commit comments

Comments
 (0)