@@ -197,7 +197,7 @@ public static ComputedNetworkFees computeFee(final FeeParams feeParams) {
197197 final long signatureUnits = signatureUnits (feeParams );
198198 final long feeUnits = transactionType == TransactionType .LOAN_PAY ?
199199 signatureUnits * feeParams .loanPaymentFeeIncrements ().longValue () :
200- signatureUnits + surchargeUnits (feeParams , transaction );
200+ signatureUnits + surchargeUnits (feeParams , transaction , false );
201201
202202 return scaleByBaseFees (baseFees , feeUnits );
203203 }
@@ -229,7 +229,7 @@ private static ComputedNetworkFees computeFeeForBatch(
229229 } else {
230230 // An inner transaction never carries signatures or fee sponsorship, so it costs one base fee plus whatever
231231 // surcharge its type attracts.
232- feeUnits += 1L + surchargeUnits (feeParams , inner );
232+ feeUnits += 1L + surchargeUnits (feeParams , inner , true );
233233 }
234234 }
235235
@@ -284,10 +284,12 @@ private static long signatureUnits(final FeeParams feeParams) {
284284 * @param feeParams The {@link FeeParams} being applied.
285285 * @param transaction The {@link Transaction} being priced, which may be an inner transaction of a Batch rather than
286286 * {@link FeeParams#transaction()} itself.
287+ * @param isInner {@code true} when {@code transaction} is a Batch inner, whose signatures are counted by the
288+ * outer Batch rather than by the inner itself.
287289 *
288290 * @return A number of extra base fees, which is zero for most transaction types.
289291 */
290- private static long surchargeUnits (final FeeParams feeParams , final Transaction transaction ) {
292+ private static long surchargeUnits (final FeeParams feeParams , final Transaction transaction , final boolean isInner ) {
291293 final TransactionType transactionType = transaction .transactionType ();
292294
293295 if (CONFIDENTIAL_MPT_TRANSACTION_TYPES .contains (transactionType )) {
@@ -297,7 +299,8 @@ private static long surchargeUnits(final FeeParams feeParams, final Transaction
297299 return fulfillmentUnits ((EscrowFinish ) transaction );
298300 }
299301 if (transactionType == TransactionType .LOAN_SET ) {
300- return feeParams .counterpartySignatureCount ().longValue ();
302+ // Charge the counterparty only for a standalone LoanSet; a Batch inner's is counted via the BatchSigners.
303+ return isInner ? 0L : feeParams .counterpartySignatureCount ().longValue ();
301304 }
302305 return 0L ;
303306 }
0 commit comments