Skip to content

Commit

Permalink
refactor(crypto): use multiPaymentLimit from milestone if avail… (#3136)
Browse files Browse the repository at this point in the history
  • Loading branch information
dated authored and faustbrian committed Oct 26, 2019
1 parent f2ced87 commit 0ef2512
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { MaximumPaymentCountExceededError } from "../../../errors";
import { ITransactionData } from "../../../interfaces";
import { configManager } from "../../../managers";
import { BigNumber } from "../../../utils";
import { MultiPaymentTransaction } from "../../types";
import { TransactionBuilder } from "./transaction";
Expand All @@ -19,7 +20,9 @@ export class MultiPaymentBuilder extends TransactionBuilder<MultiPaymentBuilder>
}

public addPayment(recipientId: string, amount: string): MultiPaymentBuilder {
if (this.data.asset.payments.length >= 500) {
const limit: number = configManager.getMilestone().multiPaymentLimit || 500;

if (this.data.asset.payments.length >= limit) {
throw new MaximumPaymentCountExceededError(this.data.asset.payments.length + 1);
}

Expand Down

0 comments on commit 0ef2512

Please sign in to comment.