The plaintiffs, having paid all interest and principal due up to June 21, 1973, on a note secured by a second mortgage which they had given to the defendants, and having on that date paid the remaining principal then owing ($22,978.20) but not the prepayment penalty called for by the note ("one half of the interest that would have been paid from the date of prepayment to the end of the term"), $9,138.66, secured a judgment (from which the defendants now appeal) declaring that the prepayment provision "is a `penalty' and is unenforceable and void" and that the payment of principal constituted payment in full of all obligations due the defendants under the note, and ordering the defendants to sign and acknowledge discharges of the mortgage. From the "Agreed Statement of Facts" approved by the judge (after entry of judgment), which we treat as a statement of all that was before the judge, in addition to the pleadings, when he rendered his decision (see Mass.R.A.P. 8[c] and [d], 365 Mass. 850 , 851 ), it appears that he ruled in effect that the prepayment provision was void on its face. That ruling cannot be sustained unless it should be established (it is not on this record) that the underlying obligation is unenforceable. See G. L. c. 107, Section 3, and the statutes therein cited; c. 140, Sections 90A-90D, 106 and 114B; c. 140C; Poorvu v. Weisberg, 286 Mass. 526 , 539-540 (1934); Manganaro Drywall, Inc. v. Penn-Simon Constr. Co. 357 Mass. 653 , 656-658 (1970). Cf. G. L. c. 271, Section 49 inserted by St. 1970, c. 826, which took effect after the execution of the note at issue in this case. Assuming, as we must on this record, that the underlying obligation is enforceable, the prepayment provision is not void as a penalty. Unlike the acceleration clause in A-Z Servicenter, Inc. v. Segall, 334 Mass. 672 (1956), the interest required to be paid bears a "rational relation" (id. at 676) to the defendants' actual damages on prepayment, merely securing to the defendants the "benefit of [their] bargain" with the plaintiffs. Manganaro Drywall, Inc. v. Penn-Simon Constr. Co. 357 Mass. at 657. Because the defendant, as second mortgage holder, was not required by law to permit prepayment (contrast G. L. c. 183, Section 56), and because the plaintiffs' prepayment constituted a voluntary election on their part, cases concerning penalties payable as "liquidated damages" in the event of breach, such as Shute v. Taylor, 5 Met. 61 (1842), Commissioner of Ins. v. Massachusetts Acc. Co. 310 Mass. 769 (1942), and Security Safety Corp. v. Kuznicki, 350 Mass. 157 (1966), are inapposite. The case must stand for trial on all issues raised by the pleadings as they are, or as they may be amended.