File tree Expand file tree Collapse file tree
src/hiero_sdk_python/transaction Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -513,8 +513,8 @@ def build_base_scheduled_body(self) -> SchedulableTransactionBody:
513513 """
514514 schedulable_body = SchedulableTransactionBody ()
515515
516- fee = self ._transaction_fee or self ._default_transaction_fee
517- if hasattr (fee , "to_tinybars" ):
516+ fee = self ._transaction_fee if self . _transaction_fee is not None else self ._default_transaction_fee
517+ if isinstance (fee , Hbar ):
518518 schedulable_body .transactionFee = int (fee .to_tinybars ())
519519 else :
520520 schedulable_body .transactionFee = int (fee )
Original file line number Diff line number Diff line change 1515
1616from hiero_sdk_python .account .account_id import AccountId
1717from hiero_sdk_python .crypto .private_key import PrivateKey
18+ from hiero_sdk_python .hapi .services import transaction_pb2
1819from hiero_sdk_python .hapi .services .transaction_response_pb2 import (
1920 TransactionResponse as TransactionResponseProto ,
2021)
@@ -795,6 +796,20 @@ def test_max_transaction_fee_survives_to_bytes_round_trip(mock_client):
795796 assert restored ._transaction_fee == Hbar (2 ).to_tinybars ()
796797
797798
799+ def test_explicit_zero_fee_is_honored_on_direct_and_scheduled_paths (mock_client ):
800+ """An explicit zero fee must reach both the direct and the scheduled body unchanged."""
801+ tx = TransferTransaction ()
802+ tx .set_max_transaction_fee (Hbar (0 ))
803+
804+ scheduled_body = tx .build_base_scheduled_body ()
805+ assert scheduled_body .transactionFee == 0
806+
807+ tx .freeze_with (mock_client )
808+ body = transaction_pb2 .TransactionBody ()
809+ body .ParseFromString (next (iter (tx ._transaction_body_bytes .values ())))
810+ assert body .transactionFee == 0
811+
812+
798813def test_freeze_with_bare_magicmock_client_resolves_default_fee ():
799814 """Freezing against a bare MagicMock client must not raise and must fall back to the per-type default fee."""
800815 tx = TransferTransaction ()
You can’t perform that action at this time.
0 commit comments