Skip to content

Commit 77e8ff1

Browse files
committed
improve comments
1 parent 8d0c719 commit 77e8ff1

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/client/fees/FeeParams.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ static ImmutableFeeParams.Builder builder() {
107107
/**
108108
* The number of signatures the transaction's own account will supply in its {@code Signers} array.
109109
*
110-
* <p>Zero for a single-signed transaction: rippled charges only for the <em>additional</em> signatures of a
111-
* multi-signature, since the first is already covered by the base fee.
110+
* <p>Zero for a single-signed transaction: rippled counts only {@code Signers} entries, and a lone signature is
111+
* carried in {@code TxnSignature} instead. For a multi-signature this is the full size of the {@code Signers}
112+
* array (e.g. 4 for a 4-of-N signer list), not one fewer — rippled charges {@code base × (1 + signersCount)}.
112113
*
113114
* @return An {@link UnsignedInteger} number of signatures, defaulting to zero.
114115
*/
@@ -134,9 +135,10 @@ default UnsignedInteger sponsorSignersCount() {
134135
/**
135136
* The total number of signatures in a {@code LoanSet}'s {@code CounterpartySignature}.
136137
*
137-
* <p>Unlike {@link #signersCount()} and {@link #sponsorSignersCount()}, this is a total rather than a count of
138-
* additional signatures: rippled charges a base fee even for a single counterparty signature. One is therefore the
139-
* correct value for a counterparty signing with a single key, and is the default.
138+
* <p>Unlike {@link #signersCount()} and {@link #sponsorSignersCount()} — which are zero when the lone signature
139+
* rides in {@code TxnSignature} — a single counterparty signature is itself charged: rippled counts
140+
* {@code CounterpartySignature.TxnSignature} as one. One is therefore the correct value for a counterparty signing
141+
* with a single key, and is the default.
140142
*
141143
* @return An {@link UnsignedInteger} number of signatures, defaulting to one.
142144
*/

xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/client/fees/FeeUtils.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import java.util.Arrays;
4848
import java.util.Map;
4949
import java.util.Objects;
50-
import java.util.Optional;
5150
import java.util.Set;
5251

5352
/**
@@ -130,12 +129,17 @@ public static ComputedNetworkFees computeMultisigNetworkFees(
130129
* Calculate a suggested fee to be used for submitting a transaction to the XRPL. The calculated value depends on the
131130
* current size of the job queue as compared to its total capacity.
132131
*
132+
* <p>This returns the base fee levels for a plain, single-signed transaction, and is correct on its own only for
133+
* transaction types that cost exactly the base fee. For anything with a different fee shape — a multi-signed or
134+
* sponsored transaction, or a type with its own rule ({@link Batch}, {@code EscrowFinish} with a fulfillment,
135+
* confidential MPT, {@code LoanSet}, {@code LoanPay}, {@code AccountDelete}, {@code AMMCreate}) — use
136+
* {@link #computeFee(FeeParams)}, which starts from these same levels and applies the type's rule.
137+
*
133138
* @param feeResult {@link FeeResult} object obtained by querying the ledger (e.g., via an `XrplClient#fee()` call).
134139
*
135140
* @return {@link ComputedNetworkFees} with low, medium and high fee levels to choose from for the transaction.
136141
*
137142
* @see "https://xrpl.org/fee.html"
138-
* @see "https://github.com/XRPL-Labs/XUMM-App/blob/master/src/services/LedgerService.ts#L244"
139143
*/
140144
public static ComputedNetworkFees computeNetworkFees(final FeeResult feeResult) {
141145
Objects.requireNonNull(feeResult);
@@ -151,11 +155,6 @@ public static ComputedNetworkFees computeNetworkFees(final FeeResult feeResult)
151155
.build();
152156
}
153157

154-
155-
156-
157-
158-
159158
/**
160159
* Computes the fee for any transaction, applying whichever of rippled's fee rules its type calls for.
161160
*

xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/Batch.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,7 @@ default Batch checkBatchSigners() {
352352

353353
// Check 4: When BatchSigners is non-empty, every account required to sign an inner transaction must have a
354354
// corresponding BatchSigner entry. The required-signer set (initiator, sponsor, and LoanSet counterparty, with
355-
// the outer account excluded) is derived by requiredSigners(), which is the single source of truth shared with
356-
// fee computation.
355+
// the outer account excluded) is derived by requiredSigners(), which is the single source of truth.
357356
if (!this.batchSigners().isEmpty()) {
358357
final Set<Address> actualSignerAccounts = this.batchSigners().stream()
359358
.map(wrapper -> wrapper.batchSigner().account())

0 commit comments

Comments
 (0)