Skip to content

Commit e04965c

Browse files
committed
Fix setting original_balance in transaction.cpp
1 parent b5734d2 commit e04965c

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

common/global-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
namespace ton {
2020

2121
// See doc/GlobalVersions.md
22-
const int SUPPORTED_VERSION = 8;
22+
const int SUPPORTED_VERSION = 9;
2323

2424
}

crypto/block/transaction.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,14 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) {
15551555
// ...
15561556
compute_phase = std::make_unique<ComputePhase>();
15571557
ComputePhase& cp = *(compute_phase.get());
1558-
original_balance -= total_fees;
1558+
if (cfg.global_version >= 9) {
1559+
original_balance = balance;
1560+
if (msg_balance_remaining.is_valid()) {
1561+
original_balance -= msg_balance_remaining;
1562+
}
1563+
} else {
1564+
original_balance -= total_fees;
1565+
}
15591566
if (td::sgn(balance.grams) <= 0) {
15601567
// no gas
15611568
cp.skip_reason = ComputePhase::sk_no_gas;

doc/GlobalVersions.md

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

0 commit comments

Comments
 (0)