@@ -62,15 +62,19 @@ def test_freeze_with_valid_parameters():
6262 # Should return self for method chaining
6363 assert result is transaction
6464
65+ # Should have transaction body bytes set
66+ assert len (transaction ._transaction_body_bytes ) > 0
67+ assert node_id in transaction ._transaction_body_bytes
68+
6569
6670@pytest .mark .parametrize (
6771 "valid_amount,expected" ,
6872 [
69- (1 , 1_00_000_000 ),
73+ (1 , 100_000_000 ),
7074 (0.1 , 10_000_000 ),
7175 (Decimal ("0.1" ), 10_000_000 ),
72- (Hbar (1 ), 1_00_000_000 ),
73- (Hbar (0 ), 0.00000000 ),
76+ (Hbar (1 ), 100_000_000 ),
77+ (Hbar (0 ), 0 ),
7478 ],
7579)
7680def test_set_max_transaction_fee_valid_param (valid_amount , expected ):
@@ -733,9 +737,11 @@ def test_fee_resolution_transaction_precedence(mock_client):
733737 # client has different default
734738 mock_client .set_max_transaction_fee (Hbar (5 ))
735739
740+ before = tx .transaction_fee
736741 tx .freeze_with (mock_client )
737742
738- assert tx .transaction_fee == 10_00_000_000
743+ assert tx .transaction_fee == 1_000_000_000
744+ assert tx .transaction_fee == before
739745
740746
741747def test_fee_resolution_client_default_used_when_transaction_missing (mock_client ):
@@ -747,7 +753,7 @@ def test_fee_resolution_client_default_used_when_transaction_missing(mock_client
747753
748754 tx .freeze_with (mock_client )
749755
750- assert tx .transaction_fee == 7_00_000_000
756+ assert tx .transaction_fee == 700_000_000
751757
752758
753759def test_fee_resolution_falls_back_to_transaction_default (mock_client ):
@@ -759,4 +765,28 @@ def test_fee_resolution_falls_back_to_transaction_default(mock_client):
759765
760766 tx .freeze_with (mock_client )
761767
762- assert tx .transaction_fee == 100000000 # Default fee for TransferTransaction
768+ assert tx .transaction_fee == 100_000_000 # Default fee for TransferTransaction
769+
770+
771+ def test_resolved_fee_serialized_into_transaction_body (mock_client ):
772+ """The resolved fee must reach the serialized proto transactionFee."""
773+ tx = TransferTransaction ()
774+
775+ tx .set_max_transaction_fee (Hbar (2 ))
776+
777+ body = tx .build_base_scheduled_body ()
778+
779+ assert body .transactionFee == Hbar (2 ).to_tinybars ()
780+
781+
782+ def test_max_transaction_fee_survives_to_bytes_round_trip (mock_client ):
783+ """An explicitly set max fee must survive a to_bytes -> from_bytes round trip."""
784+ tx = TransferTransaction ()
785+
786+ tx .set_max_transaction_fee (Hbar (2 ))
787+
788+ tx .freeze_with (mock_client ) # Serlize to_bytes()
789+ data = tx .to_bytes ()
790+
791+ restored = TransferTransaction .from_bytes (data ) # Deserialize from_bytes().
792+ assert restored ._transaction_fee == Hbar (2 ).to_tinybars ()
0 commit comments