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 {
174
174
std::unique_lock lock{mutex};
175
175
OUTCOME_TRY (ctx, loadCtx (paych));
176
176
OUTCOME_TRY (laneStates (ctx));
177
- if (amount <= laneRedeem (ctx, lane)) {
177
+ const TokenAmount delta{amount - laneRedeem (ctx, lane)};
178
+ if (delta <= 0 ) {
178
179
return ERROR_TEXT (" PaychVouchers::make voucher adds no value" );
179
180
}
180
- if (*ctx.total + amount > ctx.balance ) {
181
+ if (*ctx.total + delta > ctx.balance ) {
181
182
return ERROR_TEXT (" PaychVouchers::make insufficient balance" );
182
183
}
183
184
SignedVoucher voucher;
Original file line number Diff line number Diff line change @@ -124,5 +124,7 @@ namespace fc::paych_vouchers {
124
124
checkFails (voucher);
125
125
EXPECT_EQ (addOk (voucher, voucher.amount ), 0 );
126
126
makeFails (1 , balance - voucher.amount + 1 );
127
+ makeFails (0 , voucher.amount );
128
+ makeOk (0 , voucher.amount + 1 );
127
129
}
128
130
} // namespace fc::paych_vouchers
You can’t perform that action at this time.
0 commit comments