Review feedback from @a1q123456

- Convert STTx::getSignature to be static.
- Make the STTx::checkSign that takes a signature object private, and
  change it and all the other relevant functions to take the signature
  object as a `const&`.
- Change `getBatchTransactionIDs` to return a `const&` to reduce the
  number of vector copies. Rename `batchTxnIds_` to CamelCase. Update
  the text of the internal comment.
This commit is contained in:
Ed Hennis
2025-10-17 16:26:23 -04:00
parent 307d5474b4
commit 9c28578262
2 changed files with 41 additions and 41 deletions

View File

@@ -87,8 +87,8 @@ public:
getFullText() const override;
// Outer transaction functions / signature functions.
Blob
getSignature(STObject const& sigObject) const;
static Blob
getSignature(STObject const& sigObject);
Blob
getSignature() const
@@ -133,20 +133,6 @@ public:
enum class RequireFullyCanonicalSig : bool { no, yes };
/** Check the signature.
@param requireCanonicalSig If `true`, check that the signature is fully
canonical. If `false`, only check that the signature is valid.
@param rules The current ledger rules.
@param pSig Pointer to object that contains the signature fields, if not
using "this". Will most often be null
@return `true` if valid signature. If invalid, the error message string.
*/
Expected<void, std::string>
checkSign(
RequireFullyCanonicalSig requireCanonicalSig,
Rules const& rules,
STObject const* pSig) const;
/** Check the signature.
@param requireCanonicalSig If `true`, check that the signature is fully
canonical. If `false`, only check that the signature is valid.
@@ -177,20 +163,34 @@ public:
char status,
std::string const& escapedMetaData) const;
std::vector<uint256>
std::vector<uint256> const&
getBatchTransactionIDs() const;
private:
/** Check the signature.
@param requireCanonicalSig If `true`, check that the signature is fully
canonical. If `false`, only check that the signature is valid.
@param rules The current ledger rules.
@param sigObject Reference to object that contains the signature fields.
Will be *this more often than not.
@return `true` if valid signature. If invalid, the error message string.
*/
Expected<void, std::string>
checkSign(
RequireFullyCanonicalSig requireCanonicalSig,
Rules const& rules,
STObject const& sigObject) const;
Expected<void, std::string>
checkSingleSign(
RequireFullyCanonicalSig requireCanonicalSig,
STObject const* pSig) const;
STObject const& sigObject) const;
Expected<void, std::string>
checkMultiSign(
RequireFullyCanonicalSig requireCanonicalSig,
Rules const& rules,
STObject const* pSig) const;
STObject const& sigObject) const;
Expected<void, std::string>
checkBatchSingleSign(
@@ -209,7 +209,7 @@ private:
move(std::size_t n, void* buf) override;
friend class detail::STVar;
mutable std::vector<uint256> batch_txn_ids_;
mutable std::vector<uint256> batchTxnIds_;
};
bool