1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 11:12:16 +00:00

Fix setting original_balance in transaction.cpp

This commit is contained in:
SpyCheese 2024-09-20 15:16:46 +03:00
parent b5734d2e30
commit e04965c400
3 changed files with 15 additions and 3 deletions

View file

@ -19,6 +19,6 @@
namespace ton { namespace ton {
// See doc/GlobalVersions.md // See doc/GlobalVersions.md
const int SUPPORTED_VERSION = 8; const int SUPPORTED_VERSION = 9;
} }

View file

@ -1555,7 +1555,14 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) {
// ... // ...
compute_phase = std::make_unique<ComputePhase>(); compute_phase = std::make_unique<ComputePhase>();
ComputePhase& cp = *(compute_phase.get()); ComputePhase& cp = *(compute_phase.get());
original_balance -= total_fees; if (cfg.global_version >= 9) {
original_balance = balance;
if (msg_balance_remaining.is_valid()) {
original_balance -= msg_balance_remaining;
}
} else {
original_balance -= total_fees;
}
if (td::sgn(balance.grams) <= 0) { if (td::sgn(balance.grams) <= 0) {
// no gas // no gas
cp.skip_reason = ComputePhase::sk_no_gas; cp.skip_reason = ComputePhase::sk_no_gas;

View file

@ -109,4 +109,9 @@ Operations for working with Merkle proofs, where cells can have non-zero level a
- Slightly change random seed generation to fix mix of `addr_rewrite` and `addr`. - Slightly change random seed generation to fix mix of `addr_rewrite` and `addr`.
- Fill in `skipped_actions` for both invalid and valid messages with `IGNORE_ERROR` mode that can't be sent. - Fill in `skipped_actions` for both invalid and valid messages with `IGNORE_ERROR` mode that can't be sent.
- Allow unfreeze through external messages. - Allow unfreeze through external messages.
- Don't use user-provided `fwd_fee` and `ihr_fee` for internal messages. - Don't use user-provided `fwd_fee` and `ihr_fee` for internal messages.
## Version 9
- Fix `RAWRESERVE` action with flag `4` (use original balance of the account) by explicitly setting `original_balance` to `balance - msg_balance_remaining`.
- Previously it did not work if storage fee was greater than the original balance.