File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -174,10 +174,11 @@ namespace fc::paych_vouchers {
174174 std::unique_lock lock{mutex};
175175 OUTCOME_TRY (ctx, loadCtx (paych));
176176 OUTCOME_TRY (laneStates (ctx));
177- if (amount <= laneRedeem (ctx, lane)) {
177+ const TokenAmount delta{amount - laneRedeem (ctx, lane)};
178+ if (delta <= 0 ) {
178179 return ERROR_TEXT (" PaychVouchers::make voucher adds no value" );
179180 }
180- if (*ctx.total + amount > ctx.balance ) {
181+ if (*ctx.total + delta > ctx.balance ) {
181182 return ERROR_TEXT (" PaychVouchers::make insufficient balance" );
182183 }
183184 SignedVoucher voucher;
Original file line number Diff line number Diff line change @@ -124,5 +124,7 @@ namespace fc::paych_vouchers {
124124 checkFails (voucher);
125125 EXPECT_EQ (addOk (voucher, voucher.amount ), 0 );
126126 makeFails (1 , balance - voucher.amount + 1 );
127+ makeFails (0 , voucher.amount );
128+ makeOk (0 , voucher.amount + 1 );
127129 }
128130} // namespace fc::paych_vouchers
You can’t perform that action at this time.
0 commit comments