Skip to content

Commit

Permalink
resources: use fields name instead of index
Browse files Browse the repository at this point in the history
  • Loading branch information
ligurio committed May 25, 2021
1 parent aac5bee commit 6d7b6ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions resources/tarantool/jepsen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ box.schema.func.create('_WITHDRAW',
body = [[function(table, from, to, amount)
local s = box.space[table]
box.begin()
local b1 = s:get(from)[2] - amount
local b2 = s:get(to)[2] + amount
local b1 = s:get(from).BALANCE - amount
local b2 = s:get(to).BALANCE + amount
if b1 < 0 or b2 < 0 then
return false
end
s:update(from, {{'-', 2, amount}})
s:update(to, {{'+', 2, amount}})
s:update(from, {{'-', 'BALANCE', amount}})
s:update(to, {{'+', 'BALANCE', amount}})
box.commit()
return true
Expand Down

0 comments on commit 6d7b6ff

Please sign in to comment.