Skip to content

Commit

Permalink
Merge pull request ton-blockchain#4 from ton-blockchain/fix-timeout-d…
Browse files Browse the repository at this point in the history
…oublespend

Fix double spend when timeout is not enough to get response
  • Loading branch information
tolya-yanot authored Dec 10, 2021
2 parents b05b3fb + b7c7904 commit 9b33629
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions func/simple-subscription-plugin.fc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
int op = in_msg~load_uint(32) & 0x7fffffff;

if (op == 0x706c7567) {
int last_timeslot = (last_payment - start_at) / period;
int cur_timeslot = (now() - start_at) / period;
throw_if(49, last_timeslot >= cur_timeslot);
(int from_wc, _) = s_addr.parse_std_addr();
if( ~(flags & 1) & (msg_value > amount - chain::short_msg_fwd_fee(from_wc) ) ) {
last_payment = now();
Expand Down

0 comments on commit 9b33629

Please sign in to comment.