Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix for tonlib-cli 'transfer' command #1534

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Stanislav-Povolotsky
Copy link

Fix for 'transfer' command of tonlib-cli.

Before fix:

transferf 0 1 100000000
synchronization: 100%
Change destination address from bounceable to non-bounceable
synchronization: DONE in 8501.3us
Query {transferf 0 1 100000000} FAILED:
        [Error : 0 : Failed to add extra currencies]

After fix:

transferf 0 1 100000000
synchronization: 100%
synchronization: DONE in 38.7ms
Change destination address from bounceable to non-bounceable
Transfer sent: ok {
}

@Stanislav-Povolotsky Stanislav-Povolotsky changed the title Fix TonlibClient.cpp Fix for tonlib-cli 'transfer' command Feb 25, 2025
@bentrnr21
Copy link

Thanks for fixing the behavior of the transfer command in tonlib-cli. Could you provide more details on the specific scenarios where this issue occurred and how your changes address them? This would help the community better understand the impact of this fix and ensure similar cases are considered in the future.

@Stanislav-Povolotsky
Copy link
Author

Scenario: Run the tonlib-cli command and try to transfer TON from one wallet to another using the 'transfer' command.
Result: The command is broken and does not work 100% of the time (always fails with the error "Failed to add extra currencies")
After this fix: the command works correctly.

The proposed change modifies the condition to:

  if (!c1.is_valid()) {
    return td::Status::Error("Failed to add extra currencies");
  }

Now, the block of code inside the if statement will execute only if c1 is not valid. This change inverts the logic, meaning that if c1 is invalid, it will return an error status with the message "Failed to add extra currencies". I believe that the author of this code originally wanted to make such a check.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants