mirror of
https://github.com/XRPLF/rippled.git
synced 2026-10-12 22:58:11 +00:00
Compare commits
8 Commits
bthomee/rp
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c908ed7839 | ||
|
|
fc57311c81 | ||
|
|
818de49264 | ||
|
|
1318b1e58b | ||
|
|
617c816ec8 | ||
|
|
34fc86f585 | ||
|
|
e071f0a28d | ||
|
|
8faa624ade |
@@ -76,7 +76,6 @@ Checks: "-*,
|
||||
-readability-redundant-nested-if,
|
||||
-readability-redundant-qualified-alias,
|
||||
-readability-static-accessed-through-instance,
|
||||
-readability-trailing-comma,
|
||||
-readability-trivial-switch,
|
||||
-readability-uppercase-literal-suffix
|
||||
"
|
||||
@@ -93,10 +92,6 @@ CheckOptions:
|
||||
bugprone-unsafe-functions.ReportMoreUnsafeFunctions: true
|
||||
bugprone-unused-return-value.CheckedReturnTypes: ::std::error_code;::std::error_condition;::std::errc
|
||||
|
||||
# New in clang-tidy 23; disabled until the code is updated
|
||||
misc-const-correctness.AnalyzeAutoVariables: false
|
||||
misc-const-correctness.AnalyzeLambdas: false
|
||||
misc-const-correctness.AnalyzeParameters: false
|
||||
misc-include-cleaner.IgnoreHeaders: ".*/(detail|impl)/.*;.*fwd\\.h(pp)?;time.h;stdlib.h;sqlite3.h;netinet/in\\.h;sys/resource\\.h;sys/sysinfo\\.h;linux/sysinfo\\.h;__chrono/.*;bits/.*;_abort\\.h;boost/.*;openssl/obj_mac\\.h"
|
||||
|
||||
readability-braces-around-statements.ShortStatementLines: 2
|
||||
|
||||
2
.github/workflows/cargo-audit.yml
vendored
2
.github/workflows/cargo-audit.yml
vendored
@@ -66,7 +66,7 @@ jobs:
|
||||
|
||||
- name: Create issue
|
||||
if: ${{ steps.audit.outcome != 'success' && github.event_name == 'schedule' }}
|
||||
uses: XRPLF/actions/create-issue@2b8bc36af85b88bca0dd7bfac2e2dc05f94ad712
|
||||
uses: XRPLF/actions/create-issue@b489c21d53928f7dab4874912fec40e4f6c9e85e
|
||||
with:
|
||||
title: "cargo audit found vulnerabilities"
|
||||
body_file: /tmp/cargo-audit-issue.md
|
||||
|
||||
2
.github/workflows/check-releases-merged.yml
vendored
2
.github/workflows/check-releases-merged.yml
vendored
@@ -53,7 +53,7 @@ jobs:
|
||||
|
||||
- name: Create issue
|
||||
if: ${{ failure() && github.event_name == 'schedule' && github.repository == 'XRPLF/rippled' }}
|
||||
uses: XRPLF/actions/create-issue@2b8bc36af85b88bca0dd7bfac2e2dc05f94ad712
|
||||
uses: XRPLF/actions/create-issue@b489c21d53928f7dab4874912fec40e4f6c9e85e
|
||||
with:
|
||||
title: "Releases not merged back into develop"
|
||||
body_file: ${{ env.ISSUE_FILE }}
|
||||
|
||||
4
.github/workflows/check-tools.yml
vendored
4
.github/workflows/check-tools.yml
vendored
@@ -79,7 +79,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@b3e255d74d785d053e4903da8ac90983cd7d9e82
|
||||
uses: XRPLF/actions/prepare-runner@8e98d61f011fd2a67f3fde5f0f075662c099a527
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
@@ -108,7 +108,7 @@ jobs:
|
||||
|
||||
- name: Upload regenerated snapshot
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: check-tools-${{ runner.os }}-${{ runner.arch }}
|
||||
path: ${{ matrix.snapshot }}
|
||||
|
||||
2
.github/workflows/pre-commit.yml
vendored
2
.github/workflows/pre-commit.yml
vendored
@@ -14,7 +14,7 @@ on:
|
||||
jobs:
|
||||
# Call the workflow in the XRPLF/actions repo that runs the pre-commit hooks.
|
||||
run-hooks:
|
||||
uses: XRPLF/actions/.github/workflows/pre-commit.yml@279ec358f4a1be4088be3e024b07916fa97c75b6
|
||||
uses: XRPLF/actions/.github/workflows/pre-commit.yml@d7f2acb47d9662e1e2f8b1f5feffa6d21cc3290a
|
||||
with:
|
||||
runs_on: ubuntu-latest
|
||||
container: '{ "image": "ghcr.io/xrplf/xrpld/pre-commit:sha-70b8fd3" }'
|
||||
|
||||
2
.github/workflows/publish-docs.yml
vendored
2
.github/workflows/publish-docs.yml
vendored
@@ -47,7 +47,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@b3e255d74d785d053e4903da8ac90983cd7d9e82
|
||||
uses: XRPLF/actions/prepare-runner@8e98d61f011fd2a67f3fde5f0f075662c099a527
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
|
||||
10
.github/workflows/reusable-build-test-config.yml
vendored
10
.github/workflows/reusable-build-test-config.yml
vendored
@@ -129,7 +129,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@b3e255d74d785d053e4903da8ac90983cd7d9e82
|
||||
uses: XRPLF/actions/prepare-runner@8e98d61f011fd2a67f3fde5f0f075662c099a527
|
||||
with:
|
||||
enable_ccache: ${{ inputs.ccache_enabled }}
|
||||
|
||||
@@ -280,7 +280,7 @@ jobs:
|
||||
|
||||
- name: Upload the binary (Linux)
|
||||
if: ${{ env.PACKAGING_ARTIFACTS_ENABLED == 'true' && runner.os == 'Linux' }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: xrpld-${{ inputs.config_name }}
|
||||
path: ${{ env.BUILD_DIR }}/xrpld
|
||||
@@ -294,7 +294,7 @@ jobs:
|
||||
|
||||
- name: Upload the validator-keys binary
|
||||
if: ${{ env.PACKAGING_ARTIFACTS_ENABLED == 'true' && env.VALIDATOR_KEYS_ENABLED == 'true' }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: validator-keys-${{ inputs.config_name }}
|
||||
path: |
|
||||
@@ -305,7 +305,7 @@ jobs:
|
||||
|
||||
- name: Upload the test binary (Linux)
|
||||
if: ${{ github.event.repository.visibility == 'public' && runner.os == 'Linux' }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: xrpl_tests-${{ inputs.config_name }}
|
||||
path: ${{ env.BUILD_DIR }}/xrpl_tests
|
||||
@@ -321,7 +321,7 @@ jobs:
|
||||
|
||||
- name: Upload server definitions
|
||||
if: ${{ github.event.repository.visibility == 'public' && inputs.config_name == 'ubuntu-gcc-debug-amd64-coverage' }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: server-definitions
|
||||
path: ${{ env.BUILD_DIR }}/server_definitions.json
|
||||
|
||||
8
.github/workflows/reusable-clang-tidy.yml
vendored
8
.github/workflows/reusable-clang-tidy.yml
vendored
@@ -43,7 +43,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@b3e255d74d785d053e4903da8ac90983cd7d9e82
|
||||
uses: XRPLF/actions/prepare-runner@8e98d61f011fd2a67f3fde5f0f075662c099a527
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
@@ -109,7 +109,7 @@ jobs:
|
||||
|
||||
- name: Upload clang-tidy output
|
||||
if: ${{ github.event.repository.visibility == 'public' && steps.run_clang_tidy.outcome != 'success' }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
path: ${{ env.OUTPUT_FILE }}
|
||||
archive: false
|
||||
@@ -133,7 +133,7 @@ jobs:
|
||||
|
||||
- name: Upload clang-tidy diff output
|
||||
if: ${{ github.event.repository.visibility == 'public' && steps.files_changed.outcome != 'success' }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
path: ${{ env.DIFF_FILE }}
|
||||
archive: false
|
||||
@@ -185,7 +185,7 @@ jobs:
|
||||
|
||||
- name: Create issue
|
||||
if: ${{ steps.run_clang_tidy.outcome != 'success' && inputs.create_issue_on_failure }}
|
||||
uses: XRPLF/actions/create-issue@2b8bc36af85b88bca0dd7bfac2e2dc05f94ad712
|
||||
uses: XRPLF/actions/create-issue@b489c21d53928f7dab4874912fec40e4f6c9e85e
|
||||
with:
|
||||
title: "Clang-tidy check failed"
|
||||
body_file: ${{ env.ISSUE_FILE }}
|
||||
|
||||
@@ -44,7 +44,7 @@ jobs:
|
||||
# Every package lands in one directory; the step below picks its own,
|
||||
# which keeps this independent of the artifact names.
|
||||
- name: Download package artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
pattern: "*-pkg"
|
||||
merge-multiple: true
|
||||
|
||||
18
.github/workflows/reusable-package.yml
vendored
18
.github/workflows/reusable-package.yml
vendored
@@ -100,18 +100,18 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@b3e255d74d785d053e4903da8ac90983cd7d9e82
|
||||
uses: XRPLF/actions/prepare-runner@8e98d61f011fd2a67f3fde5f0f075662c099a527
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
- name: Download pre-built xrpld binary
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: ${{ matrix.xrpld_artifact_name }}
|
||||
path: ${{ env.BUILD_DIR }}
|
||||
|
||||
- name: Download pre-built validator-keys binary
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: ${{ matrix.validator_keys_artifact_name }}
|
||||
path: ${{ env.BUILD_DIR }}
|
||||
@@ -151,7 +151,7 @@ jobs:
|
||||
# version starts with a digit and a longer name does not, so that one digit
|
||||
# is what tells 'xrpld-3.4.1-...' from 'xrpld-assert-3.4.1-...'.
|
||||
- name: Upload package artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: ${{ matrix.xrpld_artifact_name }}-pkg
|
||||
path: |
|
||||
@@ -160,7 +160,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload debug symbol artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: ${{ matrix.xrpld_artifact_name }}-pkg-debug
|
||||
path: |
|
||||
@@ -225,13 +225,13 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@b3e255d74d785d053e4903da8ac90983cd7d9e82
|
||||
uses: XRPLF/actions/prepare-runner@8e98d61f011fd2a67f3fde5f0f075662c099a527
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
# Both artifacts, so the debug symbols are published alongside the package.
|
||||
- name: Download package artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
pattern: ${{ matrix.xrpld_artifact_name }}-pkg*
|
||||
merge-multiple: true
|
||||
@@ -287,7 +287,7 @@ jobs:
|
||||
run: echo "PUSH=${PUSH}" | tee -a "${GITHUB_ENV}"
|
||||
|
||||
- name: Download package artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
pattern: "*-pkg"
|
||||
merge-multiple: true
|
||||
@@ -295,7 +295,7 @@ jobs:
|
||||
|
||||
- name: Download voidstar binary
|
||||
if: ${{ matrix.target == 'voidstar' }}
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: xrpld-ubuntu-clang-debug-amd64-voidstar
|
||||
path: ${{ env.CONTEXT }}
|
||||
|
||||
2
.github/workflows/reusable-upload-recipe.yml
vendored
2
.github/workflows/reusable-upload-recipe.yml
vendored
@@ -50,7 +50,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@b3e255d74d785d053e4903da8ac90983cd7d9e82
|
||||
uses: XRPLF/actions/prepare-runner@8e98d61f011fd2a67f3fde5f0f075662c099a527
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
|
||||
2
.github/workflows/upload-conan-deps.yml
vendored
2
.github/workflows/upload-conan-deps.yml
vendored
@@ -68,7 +68,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@b3e255d74d785d053e4903da8ac90983cd7d9e82
|
||||
uses: XRPLF/actions/prepare-runner@8e98d61f011fd2a67f3fde5f0f075662c099a527
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
|
||||
20
crates/Cargo.lock
generated
20
crates/Cargo.lock
generated
@@ -57,9 +57,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cxx"
|
||||
version = "1.0.202"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13f6de320895f42e6e081abb5c7983bedcf0b6d0ff9323de0d33f620c8ac1199"
|
||||
checksum = "c8a02bfeba9074b2bbb39492c9b0908ec854f455a3cccdcde7a1de55e2315e40"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cxx-build",
|
||||
@@ -72,9 +72,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cxx-build"
|
||||
version = "1.0.202"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fde53ca86b9704a943fef0f1e1d836239a6aedca5de3c65fa9f97ec0bd46d39"
|
||||
checksum = "bbc2ac76997619d2d888b58ad79488f1c835de41ca4dd3dd7082acf4ecb0a50f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"codespan-reporting",
|
||||
@@ -87,9 +87,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-cmd"
|
||||
version = "1.0.202"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07bae89236c811fd4d08ed3441759ac4ac98d752cbfd3de341315ba16ad20ec3"
|
||||
checksum = "54a486ed16a3f2a053fe7f5b98db4c1a59846a23e8cb9e49f9d1bd48830d51a2"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"codespan-reporting",
|
||||
@@ -101,15 +101,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-flags"
|
||||
version = "1.0.202"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49045042e5fced01b80742aba5508de82aa4f13677ed3fa2b4cda709c40c5918"
|
||||
checksum = "c72569be94e2283764d334cd285980b747dbe221e27e315484eb6bcd93fa808a"
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-macro"
|
||||
version = "1.0.202"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b181252e2e3d3b5d183afbdc033a3958b445eb3e1a0ae65fc3d4f5259f5da6fd"
|
||||
checksum = "423e795284a7f7b3f843c956a5322c4bc497b60c2dd1a6339da10313cb18d575"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"proc-macro2",
|
||||
|
||||
@@ -34,7 +34,7 @@ lz4Compress(void const* in, std::size_t inSize, BufferFactory&& bf)
|
||||
// data
|
||||
auto compressed = bf(outCapacity);
|
||||
|
||||
auto compressedSize = LZ4_compress_default(
|
||||
auto const compressedSize = LZ4_compress_default(
|
||||
reinterpret_cast<char const*>(in),
|
||||
reinterpret_cast<char*>(compressed),
|
||||
inSize,
|
||||
|
||||
@@ -20,12 +20,14 @@ SharedIntrusive<T>::SharedIntrusive(T* p, TAdoptTag) noexcept : ptr_{p}
|
||||
|
||||
template <class T>
|
||||
SharedIntrusive<T>::SharedIntrusive(SharedIntrusive const& rhs)
|
||||
: ptr_{[&] {
|
||||
auto p = rhs.unsafeGetRawPtr();
|
||||
if (p)
|
||||
p->addStrongRef();
|
||||
return p;
|
||||
}()}
|
||||
: ptr_{
|
||||
[&] {
|
||||
auto p = rhs.unsafeGetRawPtr();
|
||||
if (p)
|
||||
p->addStrongRef();
|
||||
return p;
|
||||
}(),
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,12 +35,14 @@ template <class T>
|
||||
template <class TT>
|
||||
requires std::convertible_to<TT*, T*>
|
||||
SharedIntrusive<T>::SharedIntrusive(SharedIntrusive<TT> const& rhs)
|
||||
: ptr_{[&] {
|
||||
auto p = rhs.unsafeGetRawPtr();
|
||||
if (p)
|
||||
p->addStrongRef();
|
||||
return p;
|
||||
}()}
|
||||
: ptr_{
|
||||
[&] {
|
||||
auto p = rhs.unsafeGetRawPtr();
|
||||
if (p)
|
||||
p->addStrongRef();
|
||||
return p;
|
||||
}(),
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -140,12 +144,14 @@ SharedIntrusive<T>::~SharedIntrusive()
|
||||
template <class T>
|
||||
template <class TT>
|
||||
SharedIntrusive<T>::SharedIntrusive(StaticCastTagSharedIntrusive, SharedIntrusive<TT> const& rhs)
|
||||
: ptr_{[&] {
|
||||
auto p = static_cast<T*>(rhs.unsafeGetRawPtr());
|
||||
if (p)
|
||||
p->addStrongRef();
|
||||
return p;
|
||||
}()}
|
||||
: ptr_{
|
||||
[&] {
|
||||
auto p = static_cast<T*>(rhs.unsafeGetRawPtr());
|
||||
if (p)
|
||||
p->addStrongRef();
|
||||
return p;
|
||||
}(),
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -159,12 +165,14 @@ SharedIntrusive<T>::SharedIntrusive(StaticCastTagSharedIntrusive, SharedIntrusiv
|
||||
template <class T>
|
||||
template <class TT>
|
||||
SharedIntrusive<T>::SharedIntrusive(DynamicCastTagSharedIntrusive, SharedIntrusive<TT> const& rhs)
|
||||
: ptr_{[&] {
|
||||
auto p = dynamic_cast<T*>(rhs.unsafeGetRawPtr());
|
||||
if (p)
|
||||
p->addStrongRef();
|
||||
return p;
|
||||
}()}
|
||||
: ptr_{
|
||||
[&] {
|
||||
auto p = dynamic_cast<T*>(rhs.unsafeGetRawPtr());
|
||||
if (p)
|
||||
p->addStrongRef();
|
||||
return p;
|
||||
}(),
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -260,7 +268,7 @@ SharedIntrusive<T>::unsafeReleaseAndStore(T* next)
|
||||
return;
|
||||
|
||||
using enum ReleaseStrongRefAction;
|
||||
auto action = prev->releaseStrongRef();
|
||||
auto const action = prev->releaseStrongRef();
|
||||
switch (action)
|
||||
{
|
||||
case NoOp:
|
||||
@@ -361,7 +369,7 @@ WeakIntrusive<T>::unsafeReleaseNoStore()
|
||||
return;
|
||||
|
||||
using enum ReleaseWeakRefAction;
|
||||
auto action = ptr_->releaseWeakRef();
|
||||
auto const action = ptr_->releaseWeakRef();
|
||||
switch (action)
|
||||
{
|
||||
case NoOp:
|
||||
@@ -580,7 +588,7 @@ SharedWeakUnion<T>::convertToStrong()
|
||||
auto p = unsafeGetRawPtr();
|
||||
if (p && p->checkoutStrongRefFromWeak())
|
||||
{
|
||||
[[maybe_unused]] auto action = p->releaseWeakRef();
|
||||
[[maybe_unused]] auto const action = p->releaseWeakRef();
|
||||
XRPL_ASSERT(
|
||||
(action == ReleaseWeakRefAction::NoOp),
|
||||
"xrpl::SharedWeakUnion::convertToStrong : "
|
||||
@@ -603,7 +611,7 @@ SharedWeakUnion<T>::convertToWeak()
|
||||
return false;
|
||||
|
||||
using enum ReleaseStrongRefAction;
|
||||
auto action = p->addWeakReleaseStrongRef();
|
||||
auto const action = p->addWeakReleaseStrongRef();
|
||||
switch (action)
|
||||
{
|
||||
case NoOp:
|
||||
@@ -670,7 +678,7 @@ SharedWeakUnion<T>::unsafeReleaseNoStore()
|
||||
if (isStrong())
|
||||
{
|
||||
using enum ReleaseStrongRefAction;
|
||||
auto strongAction = p->releaseStrongRef();
|
||||
auto const strongAction = p->releaseStrongRef();
|
||||
switch (strongAction)
|
||||
{
|
||||
case NoOp:
|
||||
@@ -688,7 +696,7 @@ SharedWeakUnion<T>::unsafeReleaseNoStore()
|
||||
else
|
||||
{
|
||||
using enum ReleaseWeakRefAction;
|
||||
auto weakAction = p->releaseWeakRef();
|
||||
auto const weakAction = p->releaseWeakRef();
|
||||
switch (weakAction)
|
||||
{
|
||||
case NoOp:
|
||||
|
||||
@@ -406,10 +406,10 @@ IntrusiveRefCounts::useCount() const noexcept
|
||||
inline IntrusiveRefCounts::~IntrusiveRefCounts() noexcept
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
auto v = refCounts_.load(std::memory_order_acquire);
|
||||
auto const v = refCounts_.load(std::memory_order_acquire);
|
||||
XRPL_ASSERT(
|
||||
(!(v & kValueMask)), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
|
||||
auto t = v & kTagMask;
|
||||
auto const t = v & kTagMask;
|
||||
XRPL_ASSERT((!t || t == kTagMask), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ public:
|
||||
|
||||
for (auto const& c : cfg)
|
||||
{
|
||||
auto& a = allocators_.emplace_back(c.extra_, c.alloc_, c.align_);
|
||||
auto const& a = allocators_.emplace_back(c.extra_, c.alloc_, c.align_);
|
||||
|
||||
if (a.size() > maxSize_)
|
||||
maxSize_ = a.size();
|
||||
|
||||
@@ -300,7 +300,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
// Remove from cache, if !valid, remove from map too. Returns true if removed from cache
|
||||
std::scoped_lock const lock(mutex_);
|
||||
|
||||
auto cit = cache_.find(key);
|
||||
auto const cit = cache_.find(key);
|
||||
|
||||
if (cit == cache_.end())
|
||||
return false;
|
||||
@@ -356,7 +356,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
|
||||
std::scoped_lock const lock(mutex_);
|
||||
|
||||
auto cit = cache_.find(key);
|
||||
auto const cit = cache_.find(key);
|
||||
|
||||
if (cit == cache_.end())
|
||||
{
|
||||
@@ -371,7 +371,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
Entry& entry = cit->second;
|
||||
entry.touch(clock_.now());
|
||||
|
||||
auto shouldReplaceCached = [&] {
|
||||
auto const shouldReplaceCached = [&] {
|
||||
if constexpr (replaceCached)
|
||||
{
|
||||
return true;
|
||||
@@ -400,7 +400,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
return true;
|
||||
}
|
||||
|
||||
auto cachedData = entry.lock();
|
||||
auto const cachedData = entry.lock();
|
||||
|
||||
if (cachedData)
|
||||
{
|
||||
@@ -563,7 +563,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
retrieve(key_type const& key, T& data)
|
||||
{
|
||||
// retrieve the value of the stored data
|
||||
auto entry = fetch(key);
|
||||
auto const entry = fetch(key);
|
||||
|
||||
if (!entry)
|
||||
return false;
|
||||
@@ -687,7 +687,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto sle = h();
|
||||
auto const sle = h();
|
||||
if (!sle)
|
||||
return {};
|
||||
|
||||
@@ -713,7 +713,7 @@ inline SharedPointerType
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
initialFetch(key_type const& key, std::scoped_lock<MutexType> const& l)
|
||||
{
|
||||
auto cit = cache_.find(key);
|
||||
auto const cit = cache_.find(key);
|
||||
if (cit == cache_.end())
|
||||
return {};
|
||||
|
||||
|
||||
@@ -195,7 +195,8 @@ private:
|
||||
{
|
||||
// Local lambda that converts a single hex char to four bits and
|
||||
// ORs those bits into a uint32_t.
|
||||
auto hexCharToUInt = [](char c, std::uint32_t shift, std::uint32_t& accum) -> ParseResult {
|
||||
auto const hexCharToUInt =
|
||||
[](char c, std::uint32_t shift, std::uint32_t& accum) -> ParseResult {
|
||||
std::uint32_t nibble = 0xFFu;
|
||||
if (c < '0' || c > 'f')
|
||||
return ParseResult::BadChar;
|
||||
@@ -453,7 +454,7 @@ public:
|
||||
{
|
||||
for (int i = kWidth - 1; i >= 0; --i)
|
||||
{
|
||||
auto prev = data_[i];
|
||||
auto const prev = data_[i];
|
||||
data_[i] = boost::endian::native_to_big(boost::endian::big_to_native(data_[i]) - 1);
|
||||
|
||||
if (prev != 0)
|
||||
|
||||
@@ -365,7 +365,7 @@ public:
|
||||
size() const
|
||||
{
|
||||
std::size_t ret = 0;
|
||||
for (auto& p : map_)
|
||||
for (auto const& p : map_)
|
||||
ret += p.size();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2536,7 +2536,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
|
||||
return false;
|
||||
for (auto iter(cbegin()), last(cend()), otherLast(other.cend()); iter != last; ++iter)
|
||||
{
|
||||
auto otherIter(other.find(extract(*iter)));
|
||||
auto const otherIter(other.find(extract(*iter)));
|
||||
if (otherIter == otherLast)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ struct LexicalCast<Out, std::string_view>
|
||||
if (first != last && *first == '+')
|
||||
++first;
|
||||
|
||||
auto ret = std::from_chars(first, last, out);
|
||||
auto const ret = std::from_chars(first, last, out);
|
||||
|
||||
return ret.ec == std::errc() && ret.ptr == last;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ trimRight(String const& s)
|
||||
{
|
||||
using std::begin;
|
||||
using std::end;
|
||||
auto first(begin(s));
|
||||
auto const first(begin(s));
|
||||
auto last(end(s));
|
||||
last = trimRight(first, last);
|
||||
return {first, last};
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
Module,
|
||||
|
||||
// Match nothing (used internally)
|
||||
None
|
||||
None,
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,7 +24,7 @@ enum class Severity : std::uint8_t {
|
||||
Fatal = 5,
|
||||
|
||||
Disabled = 6,
|
||||
None = Disabled
|
||||
None = Disabled,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ enum class Type : std::uint8_t {
|
||||
PrefixSha256 = 1,
|
||||
ThresholdSha256 = 2,
|
||||
RsaSha256 = 3,
|
||||
Ed25519Sha256 = 4
|
||||
Ed25519Sha256 = 4,
|
||||
};
|
||||
|
||||
class Condition
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
using namespace der;
|
||||
|
||||
auto p = parsePreamble(s, ec);
|
||||
auto const p = parsePreamble(s, ec);
|
||||
if (ec)
|
||||
return nullptr;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ enum class Error {
|
||||
UnexpectedTag,
|
||||
LongTag,
|
||||
LargeSize,
|
||||
PreimageTooLong
|
||||
PreimageTooLong,
|
||||
};
|
||||
|
||||
std::error_code
|
||||
|
||||
@@ -396,7 +396,7 @@ inline bool
|
||||
getIfExists<bool>(Section const& section, std::string const& name, bool& v)
|
||||
{
|
||||
int intVal = 0;
|
||||
auto stat = getIfExists(section, name, intVal);
|
||||
auto const stat = getIfExists(section, name, intVal);
|
||||
if (stat)
|
||||
v = bool(intVal);
|
||||
return stat;
|
||||
|
||||
@@ -93,14 +93,14 @@ public:
|
||||
void
|
||||
check(std::vector<TxID> accepted, Predicate&& pred)
|
||||
{
|
||||
auto acceptTxid = accepted.begin();
|
||||
auto const acceptTxid = accepted.begin();
|
||||
auto const ae = accepted.end();
|
||||
std::sort(acceptTxid, ae);
|
||||
|
||||
// We want to remove all tracking entries for transactions that were
|
||||
// accepted as well as those which match the predicate.
|
||||
|
||||
auto i = removeIfIntersectOrMatch(
|
||||
auto const i = removeIfIntersectOrMatch(
|
||||
tracker_.begin(),
|
||||
tracker_.end(),
|
||||
accepted.begin(),
|
||||
|
||||
@@ -779,7 +779,7 @@ Consensus<Adaptor>::peerProposalInternal(
|
||||
|
||||
{
|
||||
// update current position
|
||||
auto peerPosIt = currPeerPositions_.find(peerID);
|
||||
auto const peerPosIt = currPeerPositions_.find(peerID);
|
||||
|
||||
if (peerPosIt != currPeerPositions_.end())
|
||||
{
|
||||
@@ -1110,7 +1110,7 @@ Consensus<Adaptor>::checkLedger(std::unique_ptr<std::stringstream> const& clog)
|
||||
{
|
||||
CLOG(clog) << "checkLedger. ";
|
||||
|
||||
auto netLgr = adaptor_.getPrevLedger(prevLedgerID_, previousLedger_, mode_.get());
|
||||
auto const netLgr = adaptor_.getPrevLedger(prevLedgerID_, previousLedger_, mode_.get());
|
||||
CLOG(clog) << "network ledgerid " << netLgr << ", "
|
||||
<< "previous ledger " << prevLedgerID_ << ". ";
|
||||
|
||||
@@ -1159,8 +1159,8 @@ Consensus<Adaptor>::phaseOpen(std::unique_ptr<std::stringstream> const& clog)
|
||||
|
||||
// it is shortly before ledger close time
|
||||
bool const anyTransactions = adaptor_.hasOpenTransactions();
|
||||
auto proposersClosed = currPeerPositions_.size();
|
||||
auto proposersValidated = adaptor_.proposersValidated(prevLedgerID_);
|
||||
auto const proposersClosed = currPeerPositions_.size();
|
||||
auto const proposersValidated = adaptor_.proposersValidated(prevLedgerID_);
|
||||
|
||||
openTime_.tick(clock_.now());
|
||||
|
||||
@@ -1669,7 +1669,7 @@ Consensus<Adaptor>::haveConsensus(std::unique_ptr<std::stringstream> const& clog
|
||||
// CHECKME: should possibly count unacquired TX sets as disagreeing
|
||||
int agree = 0, disagree = 0;
|
||||
|
||||
auto ourPosition = result_->position.position();
|
||||
auto const ourPosition = result_->position.position();
|
||||
|
||||
// Count number of agreements/disagreements with our position
|
||||
for (auto const& [nodeId, peerPos] : currPeerPositions_)
|
||||
@@ -1686,7 +1686,7 @@ Consensus<Adaptor>::haveConsensus(std::unique_ptr<std::stringstream> const& clog
|
||||
++disagree;
|
||||
}
|
||||
}
|
||||
auto currentFinished = adaptor_.proposersFinished(previousLedger_, prevLedgerID_);
|
||||
auto const currentFinished = adaptor_.proposersFinished(previousLedger_, prevLedgerID_);
|
||||
|
||||
JLOG(j_.debug()) << "Checking for TX consensus: agree=" << agree << ", disagree=" << disagree;
|
||||
|
||||
@@ -1812,7 +1812,7 @@ Consensus<Adaptor>::createDisputes(TxSetT const& o, std::unique_ptr<std::strings
|
||||
<< ". ";
|
||||
JLOG(j_.debug()) << "createDisputes " << result_->txns.id() << " to " << o.id();
|
||||
|
||||
auto differences = result_->txns.compare(o);
|
||||
auto const differences = result_->txns.compare(o);
|
||||
|
||||
int dc = 0;
|
||||
|
||||
@@ -1826,7 +1826,7 @@ Consensus<Adaptor>::createDisputes(TxSetT const& o, std::unique_ptr<std::strings
|
||||
"xrpl::Consensus::createDisputes : has disputed transactions");
|
||||
|
||||
TxT const tx = inThisSet ? result_->txns.find(txId) : o.find(txId);
|
||||
auto txID = tx.id();
|
||||
auto const txID = tx.id();
|
||||
|
||||
if (result_->disputes.find(txID) != result_->disputes.end())
|
||||
continue;
|
||||
@@ -1837,7 +1837,8 @@ Consensus<Adaptor>::createDisputes(TxSetT const& o, std::unique_ptr<std::strings
|
||||
tx,
|
||||
result_->txns.exists(txID),
|
||||
std::max(prevProposers_, currPeerPositions_.size()),
|
||||
j_};
|
||||
j_,
|
||||
};
|
||||
|
||||
// Update all of the available peer's votes on the disputed transaction
|
||||
for (auto const& [nodeId, peerPos] : currPeerPositions_)
|
||||
|
||||
@@ -145,18 +145,26 @@ struct ConsensusParms
|
||||
std::map<AvalancheState, AvalancheCutoff> const avalancheCutoffs{
|
||||
// {state, {time, percent, nextState}},
|
||||
// Initial state: 50% of nodes must vote yes
|
||||
{AvalancheState::Init,
|
||||
{.consensusTime = 0, .consensusPct = 50, .next = AvalancheState::Mid}},
|
||||
{
|
||||
AvalancheState::Init,
|
||||
{.consensusTime = 0, .consensusPct = 50, .next = AvalancheState::Mid},
|
||||
},
|
||||
// mid-consensus starts after 50% of the previous round time, and
|
||||
// requires 65% yes
|
||||
{AvalancheState::Mid,
|
||||
{.consensusTime = 50, .consensusPct = 65, .next = AvalancheState::Late}},
|
||||
{
|
||||
AvalancheState::Mid,
|
||||
{.consensusTime = 50, .consensusPct = 65, .next = AvalancheState::Late},
|
||||
},
|
||||
// late consensus starts after 85% time, and requires 70% yes
|
||||
{AvalancheState::Late,
|
||||
{.consensusTime = 85, .consensusPct = 70, .next = AvalancheState::Stuck}},
|
||||
{
|
||||
AvalancheState::Late,
|
||||
{.consensusTime = 85, .consensusPct = 70, .next = AvalancheState::Stuck},
|
||||
},
|
||||
// we're stuck after 2x time, requires 95% yes votes
|
||||
{AvalancheState::Stuck,
|
||||
{.consensusTime = 200, .consensusPct = 95, .next = AvalancheState::Stuck}},
|
||||
{
|
||||
AvalancheState::Stuck,
|
||||
{.consensusTime = 200, .consensusPct = 95, .next = AvalancheState::Stuck},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,7 @@ enum class ConsensusMode {
|
||||
* if we entered the round observing, but is used to indicate we did
|
||||
* have the wrongLedger at some point.
|
||||
*/
|
||||
SwitchedLedger
|
||||
SwitchedLedger,
|
||||
};
|
||||
|
||||
inline std::string
|
||||
@@ -222,7 +222,7 @@ medianCloseOffset(ConsensusCloseTimes const& times)
|
||||
|
||||
// Accumulate weight in time order; the first bin to reach halfWeight is
|
||||
// the (lower) weighted median. Returns true once that bin is found.
|
||||
auto step = [&](time_point t, std::int64_t w) {
|
||||
auto const step = [&](time_point t, std::int64_t w) {
|
||||
XRPL_ASSERT(tally < halfWeight, "xrpl::medianCloseOffset::step : median not yet found");
|
||||
tally += w;
|
||||
if (tally >= halfWeight)
|
||||
@@ -267,7 +267,7 @@ enum class ConsensusState {
|
||||
No, ///< We do not have consensus
|
||||
MovedOn, ///< The network has consensus without us
|
||||
Expired, ///< Consensus time limit has hard-expired
|
||||
Yes ///< We have consensus along with the network
|
||||
Yes, ///< We have consensus along with the network
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -266,7 +266,7 @@ template <class Tx, class NodeId>
|
||||
void
|
||||
DisputedTx<Tx, NodeId>::unVote(NodeId const& peer)
|
||||
{
|
||||
auto it = votes_.find(peer);
|
||||
auto const it = votes_.find(peer);
|
||||
|
||||
if (it != votes_.end())
|
||||
{
|
||||
|
||||
@@ -211,7 +211,7 @@ struct Node
|
||||
void
|
||||
erase(Node const* child)
|
||||
{
|
||||
auto it = std::ranges::find_if(
|
||||
auto const it = std::ranges::find_if(
|
||||
children, [child](std::unique_ptr<Node> const& curr) { return curr.get() == child; });
|
||||
XRPL_ASSERT(it != children.end(), "xrpl::Node::erase : valid input");
|
||||
std::swap(*it, children.back());
|
||||
|
||||
@@ -184,7 +184,7 @@ enum class ValStatus {
|
||||
/**
|
||||
* Multiple validations by a validator for different ledgers
|
||||
*/
|
||||
Conflicting
|
||||
Conflicting,
|
||||
};
|
||||
|
||||
inline std::string
|
||||
@@ -366,7 +366,7 @@ private:
|
||||
removeTrie(std::scoped_lock<Mutex> const&, NodeID const& nodeID, Validation const& val)
|
||||
{
|
||||
{
|
||||
auto it = acquiring_.find(std::make_pair(val.seq(), val.ledgerID()));
|
||||
auto const it = acquiring_.find(std::make_pair(val.seq(), val.ledgerID()));
|
||||
if (it != acquiring_.end())
|
||||
{
|
||||
it->second.erase(nodeID);
|
||||
@@ -375,7 +375,7 @@ private:
|
||||
}
|
||||
}
|
||||
{
|
||||
auto it = lastLedger_.find(nodeID);
|
||||
auto const it = lastLedger_.find(nodeID);
|
||||
if (it != lastLedger_.end() && it->second.id() == val.ledgerID())
|
||||
{
|
||||
trie_.remove(it->second);
|
||||
@@ -443,7 +443,7 @@ private:
|
||||
// Clear any prior acquiring ledger for this node
|
||||
if (prior)
|
||||
{
|
||||
auto it = acquiring_.find(*prior);
|
||||
auto const it = acquiring_.find(*prior);
|
||||
if (it != acquiring_.end())
|
||||
{
|
||||
it->second.erase(nodeID);
|
||||
@@ -455,7 +455,7 @@ private:
|
||||
checkAcquired(lock);
|
||||
|
||||
std::pair<Seq, ID> const valPair{val.seq(), val.ledgerID()};
|
||||
auto it = acquiring_.find(valPair);
|
||||
auto const it = acquiring_.find(valPair);
|
||||
if (it != acquiring_.end())
|
||||
{
|
||||
it->second.insert(nodeID);
|
||||
@@ -529,7 +529,7 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
auto cit = typename decltype(current_)::const_iterator{it};
|
||||
auto const cit = typename decltype(current_)::const_iterator{it};
|
||||
// contains a live record
|
||||
f(cit->first, cit->second);
|
||||
++it;
|
||||
@@ -554,7 +554,7 @@ private:
|
||||
void
|
||||
byLedger(std::scoped_lock<Mutex> const&, ID const& ledgerID, Pre&& pre, F&& f)
|
||||
{
|
||||
auto it = byLedger_.find(ledgerID);
|
||||
auto const it = byLedger_.find(ledgerID);
|
||||
if (it != byLedger_.end())
|
||||
{
|
||||
// Update set time since it is being used
|
||||
@@ -857,7 +857,7 @@ public:
|
||||
if (!preferred)
|
||||
{
|
||||
// fall back to majority over acquiring ledgers
|
||||
auto it = std::ranges::max_element(acquiring_, [](auto const& a, auto const& b) {
|
||||
auto const it = std::ranges::max_element(acquiring_, [](auto const& a, auto const& b) {
|
||||
std::pair<Seq, ID> const& aKey = a.first;
|
||||
typename HashSet<NodeID>::size_type const& aSize = a.second.size();
|
||||
std::pair<Seq, ID> const& bKey = b.first;
|
||||
@@ -937,7 +937,7 @@ public:
|
||||
return (preferred->first >= minSeq) ? preferred->second : lcl.id();
|
||||
|
||||
// Otherwise, rely on peer ledgers
|
||||
auto it = std::ranges::max_element(peerCounts, [](auto const& a, auto const& b) {
|
||||
auto const it = std::ranges::max_element(peerCounts, [](auto const& a, auto const& b) {
|
||||
// Prefer larger counts, then larger ids on ties
|
||||
// (max_element expects this to return true if a < b)
|
||||
return std::tie(a.second, a.first) < std::tie(b.second, b.first);
|
||||
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
{
|
||||
if (!allClosuresDoneCond_.wait_for(lock, wait, [this] { return closureCount_ == 0; }))
|
||||
{
|
||||
if (auto stream = j.error())
|
||||
if (auto const stream = j.error())
|
||||
stream << name << " waiting for ClosureCounter::join().";
|
||||
allClosuresDoneCond_.wait(lock, [this] { return closureCount_ == 0; });
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ enum class HashRouterFlags : std::uint16_t {
|
||||
PRIVATE6 = 0x2000,
|
||||
// Used in apply.cpp
|
||||
PRIVATE7 = 0x4000,
|
||||
PRIVATE8 = 0x8000
|
||||
PRIVATE8 = 0x8000,
|
||||
};
|
||||
|
||||
constexpr HashRouterFlags
|
||||
|
||||
@@ -30,12 +30,12 @@ private:
|
||||
using namespace std::chrono_literals;
|
||||
int const maxLimit = std::numeric_limits<int>::max();
|
||||
|
||||
auto add = [this](
|
||||
JobType jt,
|
||||
std::string name,
|
||||
int limit,
|
||||
std::chrono::milliseconds avgLatency,
|
||||
std::chrono::milliseconds peakLatency) {
|
||||
auto const add = [this](
|
||||
JobType jt,
|
||||
std::string name,
|
||||
int limit,
|
||||
std::chrono::milliseconds avgLatency,
|
||||
std::chrono::milliseconds peakLatency) {
|
||||
XRPL_ASSERT(!map.contains(jt), "xrpl::JobTypes::JobTypes::add : unique job type input");
|
||||
|
||||
[[maybe_unused]] auto const inserted =
|
||||
|
||||
@@ -177,12 +177,13 @@ measureDurationAndLog(
|
||||
std::chrono::duration<Rep, Period> maxDelay,
|
||||
beast::Journal const& journal)
|
||||
{
|
||||
auto startTime = std::chrono::high_resolution_clock::now();
|
||||
auto const startTime = std::chrono::high_resolution_clock::now();
|
||||
|
||||
auto result = func();
|
||||
|
||||
auto endTime = std::chrono::high_resolution_clock::now();
|
||||
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime);
|
||||
auto const endTime = std::chrono::high_resolution_clock::now();
|
||||
auto const duration =
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime);
|
||||
if (duration > maxDelay)
|
||||
{
|
||||
JLOG(journal.warn()) << actionDescription << " took " << duration.count() << " ms";
|
||||
|
||||
@@ -95,7 +95,7 @@ private:
|
||||
ArraySeparator,
|
||||
MemberSeparator,
|
||||
Comment,
|
||||
Error
|
||||
Error,
|
||||
};
|
||||
|
||||
class Token
|
||||
|
||||
@@ -26,7 +26,7 @@ enum class ValueType {
|
||||
String, ///< UTF-8 string value
|
||||
Boolean, ///< bool value
|
||||
Array, ///< array value (ordered list)
|
||||
Object ///< object value (collection of name/value pairs).
|
||||
Object, ///< object value (collection of name/value pairs).
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
beast::Journal j)
|
||||
{
|
||||
// Ask implementation what to do
|
||||
auto actions = doVoting(
|
||||
auto const actions = doVoting(
|
||||
lastClosedLedger->rules(),
|
||||
lastClosedLedger->parentCloseTime(),
|
||||
getEnabledAmendments(*lastClosedLedger),
|
||||
|
||||
@@ -50,7 +50,7 @@ enum ApplyFlags : std::uint32_t {
|
||||
// afterward, so signature-presence checks (e.g. Batch signer matching)
|
||||
// are skipped at proposal-creation time (On-Chain Cosigner spec
|
||||
// §5.3.1.2).
|
||||
TapProposal = 0x2000
|
||||
TapProposal = 0x2000,
|
||||
};
|
||||
|
||||
constexpr ApplyFlags
|
||||
|
||||
@@ -20,7 +20,8 @@ constexpr std::chrono::seconds kLedgerPossibleTimeResolutions[] = {
|
||||
std::chrono::seconds{30},
|
||||
std::chrono::seconds{60},
|
||||
std::chrono::seconds{90},
|
||||
std::chrono::seconds{120}};
|
||||
std::chrono::seconds{120},
|
||||
};
|
||||
|
||||
/**
|
||||
* Initial resolution of ledger close time.
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
{
|
||||
std::scoped_lock const lock(mutex_);
|
||||
|
||||
auto it = map_.find(seq);
|
||||
auto const it = map_.find(seq);
|
||||
|
||||
if ((it == map_.end()) || it->second)
|
||||
{
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
do
|
||||
{
|
||||
auto it = map_.find(seq);
|
||||
auto const it = map_.find(seq);
|
||||
|
||||
if (it == map_.end())
|
||||
{
|
||||
|
||||
@@ -164,7 +164,7 @@ getCandidateLedger(LedgerIndex requested)
|
||||
areCompatible(
|
||||
ReadView const& validLedger,
|
||||
ReadView const& testLedger,
|
||||
beast::Journal::Stream& s,
|
||||
beast::Journal::Stream const& s,
|
||||
char const* reason);
|
||||
|
||||
[[nodiscard]] bool
|
||||
@@ -172,7 +172,7 @@ areCompatible(
|
||||
UInt256 const& validHash,
|
||||
LedgerIndex validIndex,
|
||||
ReadView const& testLedger,
|
||||
beast::Journal::Stream& s,
|
||||
beast::Journal::Stream const& s,
|
||||
char const* reason);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -185,7 +185,7 @@ areCompatible(
|
||||
dirLink(
|
||||
ApplyView& view,
|
||||
AccountID const& owner,
|
||||
SLE::pointer& object,
|
||||
SLE::pointer const& object,
|
||||
SF_UINT64 const& node = sfOwnerNode);
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,13 +30,17 @@ public:
|
||||
static constexpr size_t kInitialBufferSize = kilobytes(256);
|
||||
|
||||
RawStateTable()
|
||||
: monotonicResource_{std::make_unique<boost::container::pmr::monotonic_buffer_resource>(
|
||||
kInitialBufferSize)}
|
||||
: monotonicResource_{
|
||||
std::make_unique<boost::container::pmr::monotonic_buffer_resource>(
|
||||
kInitialBufferSize),
|
||||
}
|
||||
, items_{monotonicResource_.get()} {};
|
||||
|
||||
RawStateTable(RawStateTable const& rhs)
|
||||
: monotonicResource_{std::make_unique<boost::container::pmr::monotonic_buffer_resource>(
|
||||
kInitialBufferSize)}
|
||||
: monotonicResource_{
|
||||
std::make_unique<boost::container::pmr::monotonic_buffer_resource>(
|
||||
kInitialBufferSize),
|
||||
}
|
||||
, items_{rhs.items_, monotonicResource_.get()}
|
||||
, dropsDestroyed_{rhs.dropsDestroyed_} {};
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ getAMMOfferStartWithTakerGets(
|
||||
if (nTakerGetsConstraint < *nTakerGets)
|
||||
nTakerGets = nTakerGetsConstraint;
|
||||
|
||||
auto getAmounts = [&pool, &tfee](Number const& nTakerGetsProposed) {
|
||||
auto const getAmounts = [&pool, &tfee](Number const& nTakerGetsProposed) {
|
||||
// Round downward to minimize the offer and to maximize the quality.
|
||||
// This has the most impact when takerGets is integral.
|
||||
auto const takerGets =
|
||||
@@ -292,7 +292,7 @@ getAMMOfferStartWithTakerPays(
|
||||
if (nTakerPaysConstraint < *nTakerPays)
|
||||
nTakerPays = nTakerPaysConstraint;
|
||||
|
||||
auto getAmounts = [&pool, &tfee](Number const& nTakerPaysProposed) {
|
||||
auto const getAmounts = [&pool, &tfee](Number const& nTakerPaysProposed) {
|
||||
// Round downward to minimize the offer and to maximize the quality.
|
||||
// This has the most impact when takerPays is integral.
|
||||
auto const takerPays =
|
||||
@@ -870,8 +870,8 @@ deleteAMMAccount(Sandbox& view, Asset const& asset, Asset const& asset2, beast::
|
||||
*/
|
||||
void
|
||||
initializeFeeAuctionVote(
|
||||
ApplyView& view,
|
||||
SLE::pointer& ammSle,
|
||||
ApplyView const& view,
|
||||
SLE::pointer const& ammSle,
|
||||
AccountID const& account,
|
||||
Asset const& lptAsset,
|
||||
std::uint16_t tfee);
|
||||
@@ -893,7 +893,7 @@ std::expected<bool, TER>
|
||||
verifyAndAdjustLPTokenBalance(
|
||||
Sandbox& sb,
|
||||
STAmount const& lpTokens,
|
||||
SLE::pointer& ammSle,
|
||||
SLE::pointer const& ammSle,
|
||||
AccountID const& account);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -20,7 +20,7 @@ enum class NodeObjectType : std::uint32_t {
|
||||
Ledger = 1,
|
||||
AccountNode = 3,
|
||||
TransactionNode = 4,
|
||||
Dummy = 512 // an invalid or missing object
|
||||
Dummy = 512, // an invalid or missing object
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ enum class Status {
|
||||
Unknown = 3,
|
||||
BackendError = 4,
|
||||
|
||||
CustomCode = 100
|
||||
CustomCode = 100,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -429,7 +429,7 @@ Livecache<Allocator>::insert(Endpoint const& ep)
|
||||
XRPL_ASSERT(
|
||||
ep.hops <= (tuning::kMaxHops + 1),
|
||||
"xrpl::peer_finder::Livecache::insert : maximum input hops");
|
||||
auto result = cache_.emplace(ep.address, ep);
|
||||
auto const result = cache_.emplace(ep.address, ep);
|
||||
Element& e(result.first->second);
|
||||
if (result.second)
|
||||
{
|
||||
@@ -497,7 +497,7 @@ Livecache<Allocator>::HopsT::shuffle()
|
||||
std::ranges::copy(list, std::back_inserter(v));
|
||||
std::shuffle(v.begin(), v.end(), defaultPrng());
|
||||
list.clear();
|
||||
for (auto& e : v)
|
||||
for (auto const& e : v)
|
||||
list.push_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
"Port not specified for address:" + remoteAddress.toString());
|
||||
}
|
||||
|
||||
auto result(fixed_.emplace(
|
||||
auto const result(fixed_.emplace(
|
||||
std::piecewise_construct,
|
||||
std::forward_as_tuple(remoteAddress),
|
||||
std::make_tuple(std::ref(clock))));
|
||||
@@ -439,7 +439,7 @@ public:
|
||||
// Mark fixed slot success
|
||||
if (slot->fixed() && !slot->inbound())
|
||||
{
|
||||
auto iter(fixed_.find(slot->remoteEndpoint()));
|
||||
auto const iter(fixed_.find(slot->remoteEndpoint()));
|
||||
if (iter == fixed_.end())
|
||||
{
|
||||
logicError(
|
||||
@@ -485,7 +485,7 @@ public:
|
||||
|
||||
// Count how many more outbound attempts to make
|
||||
//
|
||||
auto needed(counts_.attemptsNeeded());
|
||||
auto const needed(counts_.attemptsNeeded());
|
||||
if (needed == 0)
|
||||
return none;
|
||||
|
||||
@@ -903,7 +903,7 @@ public:
|
||||
// Mark fixed slot failure
|
||||
if (slot->fixed() && !slot->inbound() && slot->state() != Slot::State::Active)
|
||||
{
|
||||
auto iter(fixed_.find(slot->remoteEndpoint()));
|
||||
auto const iter(fixed_.find(slot->remoteEndpoint()));
|
||||
if (iter == fixed_.end())
|
||||
{
|
||||
logicError(
|
||||
|
||||
@@ -144,7 +144,7 @@ enum ErrorCodeI {
|
||||
RpcEntryNotFound = 98,
|
||||
RpcUnexpectedLedgerType = 99,
|
||||
|
||||
RpcLast = RpcUnexpectedLedgerType // rpcLAST should always equal the last code.
|
||||
RpcLast = RpcUnexpectedLedgerType, // rpcLAST should always equal the last code.
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,7 @@ class STTx;
|
||||
* greater than the maximum value of uint16.
|
||||
*/
|
||||
// Macro-generated, complex
|
||||
// NOLINTBEGIN(readability-trailing-comma) the macro supplies the trailing comma
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum GranularPermissionType : std::uint32_t {
|
||||
#pragma push_macro("GRANULAR_PERMISSION")
|
||||
@@ -38,6 +39,7 @@ enum GranularPermissionType : std::uint32_t {
|
||||
#undef GRANULAR_PERMISSION
|
||||
#pragma pop_macro("GRANULAR_PERMISSION")
|
||||
};
|
||||
// NOLINTEND(readability-trailing-comma)
|
||||
|
||||
class Permission
|
||||
{
|
||||
|
||||
@@ -284,8 +284,10 @@ public:
|
||||
|
||||
auto const [minV, maxV] = std::minmax(q1.value_, q2.value_);
|
||||
|
||||
auto mantissa = [](std::uint64_t rate) { return rate & ~(255ull << (64 - 8)); };
|
||||
auto exponent = [](std::uint64_t rate) { return static_cast<int>(rate >> (64 - 8)) - 100; };
|
||||
auto const mantissa = [](std::uint64_t rate) { return rate & ~(255ull << (64 - 8)); };
|
||||
auto const exponent = [](std::uint64_t rate) {
|
||||
return static_cast<int>(rate >> (64 - 8)) - 100;
|
||||
};
|
||||
|
||||
auto const minVMantissa = mantissa(minV);
|
||||
auto const maxVMantissa = mantissa(maxV);
|
||||
|
||||
@@ -29,7 +29,7 @@ struct JsonOptions
|
||||
DisableApiPriorV2 = 0b0000'0010,
|
||||
|
||||
// IMPORTANT `All` must be union of all of the above; see also operator~
|
||||
All = IncludeDate | DisableApiPriorV2 // 0b0000'0011
|
||||
All = IncludeDate | DisableApiPriorV2, // 0b0000'0011
|
||||
};
|
||||
|
||||
constexpr JsonOptions(UnderlyingT v) noexcept : value(v)
|
||||
|
||||
@@ -440,7 +440,7 @@ private:
|
||||
// These values are carefully chosen to do the right thing if passed
|
||||
// to SField::shouldInclude (bool)
|
||||
OmitSigningFields = false,
|
||||
WithAllFields = true
|
||||
WithAllFields = true,
|
||||
};
|
||||
|
||||
void
|
||||
|
||||
@@ -36,7 +36,7 @@ enum class TxnSql : char {
|
||||
Held = 'H',
|
||||
Validated = 'V',
|
||||
Included = 'I',
|
||||
Unknown = 'U'
|
||||
Unknown = 'U',
|
||||
};
|
||||
|
||||
class STTx final : public STObject, public CountedObject<STTx>
|
||||
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
bool
|
||||
getBitString(BaseUInt<Bits, Tag>& data, int offset) const
|
||||
{
|
||||
auto success = (offset + (Bits / 8)) <= data_.size();
|
||||
auto const success = (offset + (Bits / 8)) <= data_.size();
|
||||
if (success)
|
||||
memcpy(data.begin(), &data_.front() + offset, (Bits / 8));
|
||||
return success;
|
||||
|
||||
@@ -32,7 +32,7 @@ enum class SignatureRole {
|
||||
/**
|
||||
* The sponsor's signature, in sfSponsorSignature.
|
||||
*/
|
||||
Sponsor
|
||||
Sponsor,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,7 @@ enum TELcodes : TERUnderlyingType {
|
||||
telWRONG_NETWORK,
|
||||
telREQUIRES_NETWORK_ID,
|
||||
telNETWORK_ID_MAKES_TX_NON_CANONICAL,
|
||||
telENV_RPC_FAILED
|
||||
telENV_RPC_FAILED,
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -247,7 +247,7 @@ enum TEScodes : TERUnderlyingType {
|
||||
// Implications:
|
||||
// - Applied
|
||||
// - Forwarded
|
||||
tesSUCCESS = 0
|
||||
tesSUCCESS = 0,
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -319,7 +319,9 @@ inline FlagMap const&
|
||||
getUniversalFlags()
|
||||
{
|
||||
static FlagMap const flags = {
|
||||
{"tfFullyCanonicalSig", tfFullyCanonicalSig}, {"tfInnerBatchTxn", tfInnerBatchTxn}};
|
||||
{"tfFullyCanonicalSig", tfFullyCanonicalSig},
|
||||
{"tfInnerBatchTxn", tfInnerBatchTxn},
|
||||
};
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
@@ -427,7 +427,7 @@ mulDivU(Source1 value, Dest mul, Source2 div)
|
||||
static_cast<std::uint64_t>(value.value()),
|
||||
static_cast<std::uint64_t>(mul.value()));
|
||||
|
||||
auto quotient = product / div.value();
|
||||
auto const quotient = product / div.value();
|
||||
|
||||
if (quotient > kMax)
|
||||
return std::nullopt;
|
||||
|
||||
@@ -236,7 +236,7 @@ enum class AttestationMatch {
|
||||
// all of the fields match, except the dst field
|
||||
MatchExceptDst,
|
||||
// all of the fields match
|
||||
Match
|
||||
Match,
|
||||
};
|
||||
|
||||
struct XChainClaimAttestation
|
||||
|
||||
@@ -119,13 +119,13 @@ inplaceBigintDivRem(std::span<uint64_t> numerator, std::uint64_t divisor)
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
|
||||
auto toU128 = [](std::uint64_t high, std::uint64_t low) -> unsigned __int128 {
|
||||
auto const toU128 = [](std::uint64_t high, std::uint64_t low) -> unsigned __int128 {
|
||||
unsigned __int128 const high128 = high;
|
||||
unsigned __int128 const low128 = low;
|
||||
return ((high128 << 64) | low128);
|
||||
};
|
||||
auto divRe64 = [](unsigned __int128 num,
|
||||
std::uint64_t denom) -> std::tuple<std::uint64_t, std::uint64_t> {
|
||||
auto const divRe64 = [](unsigned __int128 num,
|
||||
std::uint64_t denom) -> std::tuple<std::uint64_t, std::uint64_t> {
|
||||
unsigned __int128 const denom128 = denom;
|
||||
unsigned __int128 const d = num / denom128;
|
||||
unsigned __int128 const r = num - (denom128 * d);
|
||||
|
||||
@@ -24,7 +24,7 @@ enum class TokenType : std::uint8_t {
|
||||
AccountPublic = 35,
|
||||
AccountSecret = 34,
|
||||
FamilyGenerator = 41, // unused
|
||||
FamilySeed = 33
|
||||
FamilySeed = 33,
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
||||
@@ -46,9 +46,10 @@ inline constexpr std::uint32_t kSqliteTuningCutoff = 10'000'000;
|
||||
inline constexpr auto kLgrDbName{"ledger.db"};
|
||||
|
||||
inline constexpr std::array<char const*, 5> kLgrDbInit{
|
||||
{"BEGIN TRANSACTION;",
|
||||
{
|
||||
"BEGIN TRANSACTION;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS Ledgers ( \
|
||||
"CREATE TABLE IF NOT EXISTS Ledgers ( \
|
||||
LedgerHash CHARACTER(64) PRIMARY KEY, \
|
||||
LedgerSeq BIGINT UNSIGNED, \
|
||||
PrevHash CHARACTER(64), \
|
||||
@@ -60,12 +61,14 @@ inline constexpr std::array<char const*, 5> kLgrDbInit{
|
||||
AccountSetHash CHARACTER(64), \
|
||||
TransSetHash CHARACTER(64) \
|
||||
);",
|
||||
"CREATE INDEX IF NOT EXISTS SeqLedger ON Ledgers(LedgerSeq);",
|
||||
"CREATE INDEX IF NOT EXISTS SeqLedger ON Ledgers(LedgerSeq);",
|
||||
|
||||
// Old table and indexes no longer needed
|
||||
"DROP TABLE IF EXISTS Validations;",
|
||||
// Old table and indexes no longer needed
|
||||
"DROP TABLE IF EXISTS Validations;",
|
||||
|
||||
"END TRANSACTION;"}};
|
||||
"END TRANSACTION;",
|
||||
},
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -73,9 +76,10 @@ inline constexpr std::array<char const*, 5> kLgrDbInit{
|
||||
inline constexpr auto kTxDbName{"transaction.db"};
|
||||
|
||||
inline constexpr std::array<char const*, 8> kTxDbInit{
|
||||
{"BEGIN TRANSACTION;",
|
||||
{
|
||||
"BEGIN TRANSACTION;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS Transactions ( \
|
||||
"CREATE TABLE IF NOT EXISTS Transactions ( \
|
||||
TransID CHARACTER(64) PRIMARY KEY, \
|
||||
TransType CHARACTER(24), \
|
||||
FromAcct CHARACTER(35), \
|
||||
@@ -85,57 +89,62 @@ inline constexpr std::array<char const*, 8> kTxDbInit{
|
||||
RawTxn BLOB, \
|
||||
TxnMeta BLOB \
|
||||
);",
|
||||
"CREATE INDEX IF NOT EXISTS TxLgrIndex ON \
|
||||
"CREATE INDEX IF NOT EXISTS TxLgrIndex ON \
|
||||
Transactions(LedgerSeq);",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS AccountTransactions ( \
|
||||
"CREATE TABLE IF NOT EXISTS AccountTransactions ( \
|
||||
TransID CHARACTER(64), \
|
||||
Account CHARACTER(64), \
|
||||
LedgerSeq BIGINT UNSIGNED, \
|
||||
TxnSeq INTEGER \
|
||||
);",
|
||||
"CREATE INDEX IF NOT EXISTS AcctTxIDIndex ON \
|
||||
"CREATE INDEX IF NOT EXISTS AcctTxIDIndex ON \
|
||||
AccountTransactions(TransID);",
|
||||
"CREATE INDEX IF NOT EXISTS AcctTxIndex ON \
|
||||
"CREATE INDEX IF NOT EXISTS AcctTxIndex ON \
|
||||
AccountTransactions(Account, LedgerSeq, TxnSeq, TransID);",
|
||||
"CREATE INDEX IF NOT EXISTS AcctLgrIndex ON \
|
||||
"CREATE INDEX IF NOT EXISTS AcctLgrIndex ON \
|
||||
AccountTransactions(LedgerSeq, Account, TransID);",
|
||||
|
||||
"END TRANSACTION;"}};
|
||||
"END TRANSACTION;",
|
||||
},
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline constexpr auto kWalletDbName{"wallet.db"};
|
||||
|
||||
inline constexpr std::array<char const*, 6> kWalletDbInit{
|
||||
{"BEGIN TRANSACTION;",
|
||||
{
|
||||
"BEGIN TRANSACTION;",
|
||||
|
||||
// A node's identity must be persisted, including
|
||||
// for clustering purposes. This table holds one
|
||||
// entry: the server's unique identity, but the
|
||||
// value can be overriden by specifying a node
|
||||
// identity in the config file using a [node_seed]
|
||||
// entry.
|
||||
"CREATE TABLE IF NOT EXISTS NodeIdentity ( \
|
||||
// A node's identity must be persisted, including
|
||||
// for clustering purposes. This table holds one
|
||||
// entry: the server's unique identity, but the
|
||||
// value can be overriden by specifying a node
|
||||
// identity in the config file using a [node_seed]
|
||||
// entry.
|
||||
"CREATE TABLE IF NOT EXISTS NodeIdentity ( \
|
||||
PublicKey CHARACTER(53), \
|
||||
PrivateKey CHARACTER(52) \
|
||||
);",
|
||||
|
||||
// Peer reservations
|
||||
"CREATE TABLE IF NOT EXISTS PeerReservations ( \
|
||||
// Peer reservations
|
||||
"CREATE TABLE IF NOT EXISTS PeerReservations ( \
|
||||
PublicKey CHARACTER(53) UNIQUE NOT NULL, \
|
||||
Description CHARACTER(64) NOT NULL \
|
||||
);",
|
||||
|
||||
// Validator Manifests
|
||||
"CREATE TABLE IF NOT EXISTS ValidatorManifests ( \
|
||||
// Validator Manifests
|
||||
"CREATE TABLE IF NOT EXISTS ValidatorManifests ( \
|
||||
RawData BLOB NOT NULL \
|
||||
);",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS PublisherManifests ( \
|
||||
"CREATE TABLE IF NOT EXISTS PublisherManifests ( \
|
||||
RawData BLOB NOT NULL \
|
||||
);",
|
||||
|
||||
"END TRANSACTION;"}};
|
||||
"END TRANSACTION;",
|
||||
},
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -50,8 +50,8 @@ struct LedgerRange
|
||||
enum class DelegateType {
|
||||
Actor, ///< Another account signed and submitted transactions on behalf of this account (this
|
||||
///< account is the owner/delegator).
|
||||
Authorizer ///< This account signed and submitted transactions on behalf of another account
|
||||
///< (this account is the signer/delegatee).
|
||||
Authorizer, ///< This account signed and submitted transactions on behalf of another account
|
||||
///< (this account is the signer/delegatee).
|
||||
};
|
||||
|
||||
struct DelegateFilter
|
||||
|
||||
@@ -21,7 +21,7 @@ enum class Disposition {
|
||||
* Consumer should be disconnected for excess consumption.
|
||||
*/
|
||||
,
|
||||
Drop
|
||||
Drop,
|
||||
};
|
||||
|
||||
} // namespace xrpl::resource
|
||||
|
||||
@@ -334,7 +334,7 @@ public:
|
||||
if (iter->whenExpires <= elapsed)
|
||||
{
|
||||
JLOG(journal_.debug()) << "Expired " << *iter;
|
||||
auto tableIter = table_.find(*iter->key);
|
||||
auto const tableIter = table_.find(*iter->key);
|
||||
++iter;
|
||||
erase(tableIter);
|
||||
}
|
||||
@@ -437,7 +437,8 @@ public:
|
||||
static_assert(
|
||||
kFeeLogAsWarn > kFeeLogAsInfo && kFeeLogAsInfo > kFeeLogAsDebug && kFeeLogAsDebug > 10);
|
||||
|
||||
static auto kGetStream = [](resource::Charge::value_type cost, beast::Journal& journal) {
|
||||
static auto const kGetStream = [](resource::Charge::value_type cost,
|
||||
beast::Journal& journal) {
|
||||
if (cost >= kFeeLogAsWarn)
|
||||
return journal.warn();
|
||||
if (cost >= kFeeLogAsInfo)
|
||||
|
||||
@@ -328,7 +328,7 @@ enum class ManifestDisposition {
|
||||
|
||||
Invalid, ///< Timely, but invalid signature
|
||||
|
||||
UntrustedCapacity ///< Unlisted and limit reached
|
||||
UntrustedCapacity, ///< Unlisted and limit reached
|
||||
};
|
||||
|
||||
inline std::string
|
||||
@@ -361,8 +361,8 @@ to_string(ManifestDisposition m)
|
||||
* configured keys should use `Uncapped`.
|
||||
*/
|
||||
enum class ManifestRateLimitCapPolicy : std::uint8_t {
|
||||
Capped, ///< Subject to the untrusted cap (unlisted peer gossip)
|
||||
Uncapped ///< Bypasses the cap (listed/trusted or config manifests)
|
||||
Capped, ///< Subject to the untrusted cap (unlisted peer gossip)
|
||||
Uncapped, ///< Bypasses the cap (listed/trusted or config manifests)
|
||||
};
|
||||
|
||||
class DatabaseCon;
|
||||
|
||||
@@ -62,7 +62,7 @@ enum class OperatingMode {
|
||||
CONNECTED = 1, ///< convinced we are talking to the network
|
||||
SYNCING = 2, ///< fallen slightly behind
|
||||
TRACKING = 3, ///< convinced we agree with the network
|
||||
FULL = 4 ///< we have the ledger and can even validate
|
||||
FULL = 4, ///< we have the ledger and can even validate
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -267,7 +267,7 @@ template <class Handler, class Impl>
|
||||
void
|
||||
BaseHTTPPeer<Handler, Impl>::onTimer()
|
||||
{
|
||||
auto ec = boost::system::errc::make_error_code(boost::system::errc::timed_out);
|
||||
auto const ec = boost::system::errc::make_error_code(boost::system::errc::timed_out);
|
||||
fail(ec, "timer");
|
||||
}
|
||||
|
||||
|
||||
@@ -96,10 +96,12 @@ private:
|
||||
boost::asio::strand<boost::asio::io_context::executor_type> strand_;
|
||||
bool ssl_{
|
||||
port_.protocol.contains("https") || port_.protocol.contains("wss") ||
|
||||
port_.protocol.contains("wss2") || port_.protocol.contains("peer")};
|
||||
port_.protocol.contains("wss2") || port_.protocol.contains("peer"),
|
||||
};
|
||||
bool plain_{
|
||||
port_.protocol.contains("http") || port_.protocol.contains("ws") ||
|
||||
port_.protocol.contains("ws2")};
|
||||
port_.protocol.contains("ws2"),
|
||||
};
|
||||
static constexpr std::chrono::milliseconds kInitialAcceptDelay{50};
|
||||
static constexpr std::chrono::milliseconds kMaxAcceptDelay{2000};
|
||||
std::chrono::milliseconds acceptDelay_{kInitialAcceptDelay};
|
||||
@@ -207,12 +209,12 @@ Door<Handler>::Detector::doDetect(boost::asio::yield_context doYield)
|
||||
{
|
||||
if (ssl)
|
||||
{
|
||||
if (auto sp = ios().template emplace<SSLHTTPPeer<Handler>>(
|
||||
if (auto const sp = ios().template emplace<SSLHTTPPeer<Handler>>(
|
||||
port_, handler_, ioc_, j_, remoteAddress_, buf.data(), std::move(stream_)))
|
||||
sp->run();
|
||||
return;
|
||||
}
|
||||
if (auto sp = ios().template emplace<PlainHTTPPeer<Handler>>(
|
||||
if (auto const sp = ios().template emplace<PlainHTTPPeer<Handler>>(
|
||||
port_, handler_, ioc_, j_, remoteAddress_, buf.data(), std::move(stream_)))
|
||||
sp->run();
|
||||
return;
|
||||
@@ -328,12 +330,12 @@ Door<Handler>::create(
|
||||
{
|
||||
if (ssl)
|
||||
{
|
||||
if (auto sp = ios().template emplace<SSLHTTPPeer<Handler>>(
|
||||
if (auto const sp = ios().template emplace<SSLHTTPPeer<Handler>>(
|
||||
port_, handler_, ioc_, j_, remoteAddress, buffers, std::move(stream)))
|
||||
sp->run();
|
||||
return;
|
||||
}
|
||||
if (auto sp = ios().template emplace<PlainHTTPPeer<Handler>>(
|
||||
if (auto const sp = ios().template emplace<PlainHTTPPeer<Handler>>(
|
||||
port_, handler_, ioc_, j_, remoteAddress, buffers, std::move(stream)))
|
||||
sp->run();
|
||||
}
|
||||
@@ -390,7 +392,7 @@ Door<Handler>::doAccept(boost::asio::yield_context doYield)
|
||||
|
||||
if (ssl_ && plain_)
|
||||
{
|
||||
if (auto sp = ios().template emplace<Detector>(
|
||||
if (auto const sp = ios().template emplace<Detector>(
|
||||
port_, handler_, ioc_, std::move(stream), remoteAddress, j_))
|
||||
sp->run();
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ ServerImpl<Handler>::ports(std::vector<Port> const& ports)
|
||||
{
|
||||
ports_.push_back(port);
|
||||
auto& internalPort = ports_.back();
|
||||
if (auto sp = ios_.emplace<Door<Handler>>(handler_, ioContext_, internalPort, j_))
|
||||
if (auto const sp = ios_.emplace<Door<Handler>>(handler_, ioContext_, internalPort, j_))
|
||||
{
|
||||
list_.push_back(sp);
|
||||
|
||||
|
||||
@@ -225,14 +225,14 @@ IOList::close(Finisher&& f)
|
||||
if (closed_)
|
||||
return;
|
||||
closed_ = true;
|
||||
auto map = std::move(map_);
|
||||
auto const map = std::move(map_);
|
||||
if (!map.empty())
|
||||
{
|
||||
f_ = std::forward<Finisher>(f);
|
||||
lock.unlock();
|
||||
for (auto const& p : map)
|
||||
{
|
||||
if (auto sp = p.second.lock())
|
||||
if (auto const sp = p.second.lock())
|
||||
sp->close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ private:
|
||||
XRPL_ASSERT(node, "xrpl::SHAMap::NodePathStack::pushChild : non-null node input");
|
||||
XRPL_ASSERT(
|
||||
!stack_.empty(), "xrpl::SHAMap::NodePathStack::pushChild : non-empty stack");
|
||||
auto childID = stack_.top().second.getChildNodeID(branch);
|
||||
auto const childID = stack_.top().second.getChildNodeID(branch);
|
||||
XRPL_ASSERT_IF(
|
||||
node->isInner(),
|
||||
childID.getDepth() < kLeafDepth,
|
||||
@@ -495,7 +495,7 @@ private:
|
||||
node->isLeaf(),
|
||||
childID.isPrefixOf(leafKey(*node)),
|
||||
"xrpl::SHAMap::NodePathStack::pushChild : leaf key below branch");
|
||||
stack_.emplace(std::move(node), std::move(childID));
|
||||
stack_.emplace(std::move(node), childID);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -878,7 +878,7 @@ SHAMap::ConstIterator::operator++()
|
||||
inline SHAMap::ConstIterator
|
||||
SHAMap::ConstIterator::operator++(int)
|
||||
{
|
||||
auto tmp = *this;
|
||||
auto const tmp = *this;
|
||||
++(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -14,35 +14,112 @@ private:
|
||||
|
||||
public:
|
||||
SHAMapAddNode();
|
||||
|
||||
/**
|
||||
* Record one node that was rejected.
|
||||
*/
|
||||
void
|
||||
incInvalid();
|
||||
|
||||
/**
|
||||
* Record one node that produced a good result.
|
||||
*/
|
||||
void
|
||||
incUseful();
|
||||
|
||||
/**
|
||||
* Record one node that was not needed: the map already held it, or the map
|
||||
* or its acquisition was no longer taking nodes. isGood() counts it on the
|
||||
* accepted side.
|
||||
*/
|
||||
void
|
||||
incDuplicate();
|
||||
void
|
||||
reset();
|
||||
|
||||
/**
|
||||
* @return How many nodes produced a good result.
|
||||
*/
|
||||
[[nodiscard]] int
|
||||
getGood() const;
|
||||
|
||||
/**
|
||||
* @return How many nodes this code rejected, which is not how many the
|
||||
* batch was given: a batch that stops at its first bad node counts
|
||||
* one, and a batch that carries on counts each.
|
||||
*/
|
||||
[[nodiscard]] int
|
||||
getBad() const;
|
||||
|
||||
/**
|
||||
* @return How many nodes were not needed, whether already held or offered
|
||||
* to a map no longer taking nodes, tallied apart from the good and
|
||||
* bad counts.
|
||||
*/
|
||||
[[nodiscard]] int
|
||||
getDuplicate() const;
|
||||
|
||||
/**
|
||||
* Whether nodes that produced a good result or were not needed outnumber
|
||||
* the ones rejected.
|
||||
*
|
||||
* @return Whether the batch was good.
|
||||
*/
|
||||
[[nodiscard]] bool
|
||||
isGood() const;
|
||||
|
||||
/**
|
||||
* @return Whether at least one node in the batch was rejected.
|
||||
*/
|
||||
[[nodiscard]] bool
|
||||
isInvalid() const;
|
||||
|
||||
/**
|
||||
* @return Whether at least one node in the batch produced a good result.
|
||||
*/
|
||||
[[nodiscard]] bool
|
||||
isUseful() const;
|
||||
|
||||
/**
|
||||
* @return A verdict recording one node that was not needed.
|
||||
*/
|
||||
static SHAMapAddNode
|
||||
duplicate();
|
||||
|
||||
/**
|
||||
* @return A verdict recording one useful node.
|
||||
*/
|
||||
static SHAMapAddNode
|
||||
useful();
|
||||
|
||||
/**
|
||||
* @return A verdict recording one invalid node.
|
||||
*/
|
||||
static SHAMapAddNode
|
||||
invalid();
|
||||
|
||||
/**
|
||||
* Clear every count back to zero.
|
||||
*/
|
||||
void
|
||||
reset();
|
||||
|
||||
/**
|
||||
* Render the tally as a log line.
|
||||
*
|
||||
* @return The tally, e.g. "good:2 bad:1 dupe:1", or "no nodes processed" if
|
||||
* every count is zero.
|
||||
*/
|
||||
[[nodiscard]] std::string
|
||||
get() const;
|
||||
|
||||
/**
|
||||
* Add another verdict's counts into this one.
|
||||
*
|
||||
* @param n The verdict to add.
|
||||
* @return This verdict, updated.
|
||||
*/
|
||||
SHAMapAddNode&
|
||||
operator+=(SHAMapAddNode const& n);
|
||||
|
||||
static SHAMapAddNode
|
||||
duplicate();
|
||||
static SHAMapAddNode
|
||||
useful();
|
||||
static SHAMapAddNode
|
||||
invalid();
|
||||
|
||||
private:
|
||||
SHAMapAddNode(int good, int bad, int duplicate);
|
||||
};
|
||||
@@ -74,18 +151,30 @@ SHAMapAddNode::incDuplicate()
|
||||
++duplicate_;
|
||||
}
|
||||
|
||||
inline void
|
||||
SHAMapAddNode::reset()
|
||||
{
|
||||
good_ = bad_ = duplicate_ = 0;
|
||||
}
|
||||
|
||||
inline int
|
||||
SHAMapAddNode::getGood() const
|
||||
{
|
||||
return good_;
|
||||
}
|
||||
|
||||
inline int
|
||||
SHAMapAddNode::getBad() const
|
||||
{
|
||||
return bad_;
|
||||
}
|
||||
|
||||
inline int
|
||||
SHAMapAddNode::getDuplicate() const
|
||||
{
|
||||
return duplicate_;
|
||||
}
|
||||
|
||||
inline bool
|
||||
SHAMapAddNode::isGood() const
|
||||
{
|
||||
return (good_ + duplicate_) > bad_;
|
||||
}
|
||||
|
||||
inline bool
|
||||
SHAMapAddNode::isInvalid() const
|
||||
{
|
||||
@@ -98,22 +187,6 @@ SHAMapAddNode::isUseful() const
|
||||
return good_ > 0;
|
||||
}
|
||||
|
||||
inline SHAMapAddNode&
|
||||
SHAMapAddNode::operator+=(SHAMapAddNode const& n)
|
||||
{
|
||||
good_ += n.good_;
|
||||
bad_ += n.bad_;
|
||||
duplicate_ += n.duplicate_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool
|
||||
SHAMapAddNode::isGood() const
|
||||
{
|
||||
return (good_ + duplicate_) > bad_;
|
||||
}
|
||||
|
||||
inline SHAMapAddNode
|
||||
SHAMapAddNode::duplicate()
|
||||
{
|
||||
@@ -132,6 +205,12 @@ SHAMapAddNode::invalid()
|
||||
return SHAMapAddNode(0, 1, 0);
|
||||
}
|
||||
|
||||
inline void
|
||||
SHAMapAddNode::reset()
|
||||
{
|
||||
good_ = bad_ = duplicate_ = 0;
|
||||
}
|
||||
|
||||
inline std::string
|
||||
SHAMapAddNode::get() const
|
||||
{
|
||||
@@ -160,4 +239,14 @@ SHAMapAddNode::get() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline SHAMapAddNode&
|
||||
SHAMapAddNode::operator+=(SHAMapAddNode const& n)
|
||||
{
|
||||
good_ += n.good_;
|
||||
bad_ += n.bad_;
|
||||
duplicate_ += n.duplicate_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -31,7 +31,7 @@ enum class SHAMapNodeType {
|
||||
TnInner = 1,
|
||||
TnTransactionNm = 2, // transaction, no metadata
|
||||
TnTransactionMd = 3, // transaction, with metadata
|
||||
TnAccountState = 4
|
||||
TnAccountState = 4,
|
||||
};
|
||||
|
||||
class SHAMapTreeNode : public IntrusiveRefCounts
|
||||
|
||||
@@ -33,7 +33,7 @@ enum class Validity {
|
||||
/**
|
||||
* Signature and local checks are good / passed.
|
||||
*/
|
||||
Valid
|
||||
Valid,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -133,7 +133,7 @@ enum class ApplyTransactionResult {
|
||||
/**
|
||||
* Should be retried in this ledger
|
||||
*/
|
||||
Retry
|
||||
Retry,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
* Affects the ability of subsequent transactions
|
||||
* to claim a fee. Eg. `SetRegularKey`
|
||||
*/
|
||||
Blocker
|
||||
Blocker,
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@@ -19,6 +19,7 @@ setUnion(boost::container::flat_set<T>& dst, boost::container::flat_set<T> const
|
||||
return;
|
||||
|
||||
dst.reserve(dst.size() + src.size());
|
||||
// NOLINTNEXTLINE(readability-trailing-comma) fix-it drops comma after `{}`
|
||||
dst.insert(boost::container::ordered_unique_range_t{}, src.begin(), src.end());
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ struct FlowDebugInfo
|
||||
[[nodiscard]] auto
|
||||
duration(std::string const& tag) const
|
||||
{
|
||||
auto i = timePoints.find(tag);
|
||||
auto const i = timePoints.find(tag);
|
||||
if (i == timePoints.end())
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
@@ -119,7 +119,7 @@ struct FlowDebugInfo
|
||||
[[nodiscard]] std::size_t
|
||||
count(std::string const& tag) const
|
||||
{
|
||||
auto i = counts.find(tag);
|
||||
auto const i = counts.find(tag);
|
||||
if (i == counts.end())
|
||||
return 0;
|
||||
return i->second;
|
||||
@@ -151,7 +151,7 @@ struct FlowDebugInfo
|
||||
void
|
||||
inc(std::string const& tag)
|
||||
{
|
||||
auto i = counts.find(tag);
|
||||
auto const i = counts.find(tag);
|
||||
if (i == counts.end())
|
||||
{
|
||||
counts[tag] = 1;
|
||||
@@ -212,24 +212,25 @@ struct FlowDebugInfo
|
||||
};
|
||||
auto writeXrpAmtList = [&writeList](
|
||||
std::vector<EitherAmount> const& amts, char delim = ';') {
|
||||
auto getVal = [](EitherAmount const& a) -> std::string {
|
||||
auto const getVal = [](EitherAmount const& a) -> std::string {
|
||||
return xrpl::to_string(a.get<XRPAmount>());
|
||||
};
|
||||
writeList(amts, getVal, delim);
|
||||
};
|
||||
auto writeIouAmtList = [&writeList](
|
||||
std::vector<EitherAmount> const& amts, char delim = ';') {
|
||||
auto getVal = [](EitherAmount const& a) -> std::string {
|
||||
auto const getVal = [](EitherAmount const& a) -> std::string {
|
||||
return xrpl::to_string(a.get<IOUAmount>());
|
||||
};
|
||||
writeList(amts, getVal, delim);
|
||||
};
|
||||
auto writeIntList = [&writeList](std::vector<size_t> const& vals, char delim = ';') {
|
||||
auto const writeIntList = [&writeList](
|
||||
std::vector<size_t> const& vals, char delim = ';') {
|
||||
// NOLINTNEXTLINE(bugprone-return-const-ref-from-parameter)
|
||||
auto getVal = [](size_t const& v) -> size_t const& { return v; };
|
||||
auto const getVal = [](size_t const& v) -> size_t const& { return v; };
|
||||
writeList(vals, getVal);
|
||||
};
|
||||
auto writeNestedIouAmtList =
|
||||
auto const writeNestedIouAmtList =
|
||||
[&ostr, &writeIouAmtList](std::vector<std::vector<EitherAmount>> const& amts) {
|
||||
ostr << '[';
|
||||
if (!amts.empty())
|
||||
@@ -243,7 +244,7 @@ struct FlowDebugInfo
|
||||
}
|
||||
ostr << ']';
|
||||
};
|
||||
auto writeNestedXrpAmtList =
|
||||
auto const writeNestedXrpAmtList =
|
||||
[&ostr, &writeXrpAmtList](std::vector<std::vector<EitherAmount>> const& amts) {
|
||||
ostr << '[';
|
||||
if (!amts.empty())
|
||||
|
||||
@@ -25,7 +25,7 @@ checkFreeze(
|
||||
XRPL_ASSERT(src != dst, "xrpl::checkFreeze : unequal input accounts");
|
||||
|
||||
// check freeze
|
||||
if (auto sle = view.read(keylet::account(dst)))
|
||||
if (auto const sle = view.read(keylet::account(dst)))
|
||||
{
|
||||
if (sle->isFlag(lsfGlobalFreeze))
|
||||
{
|
||||
@@ -33,7 +33,7 @@ checkFreeze(
|
||||
}
|
||||
}
|
||||
|
||||
if (auto sle = view.read(keylet::trustLine(src, dst, currency)))
|
||||
if (auto const sle = view.read(keylet::trustLine(src, dst, currency)))
|
||||
{
|
||||
if (sle->isFlag((dst > src) ? lsfHighFreeze : lsfLowFreeze))
|
||||
{
|
||||
@@ -77,8 +77,8 @@ checkNoRipple(
|
||||
beast::Journal j)
|
||||
{
|
||||
// fetch the ripple lines into and out of this node
|
||||
auto sleIn = view.read(keylet::trustLine(prev, cur, currency));
|
||||
auto sleOut = view.read(keylet::trustLine(cur, next, currency));
|
||||
auto const sleIn = view.read(keylet::trustLine(prev, cur, currency));
|
||||
auto const sleOut = view.read(keylet::trustLine(cur, next, currency));
|
||||
|
||||
if (!sleIn || !sleOut)
|
||||
return terNO_LINE;
|
||||
|
||||
@@ -647,7 +647,7 @@ flow(
|
||||
|
||||
// Returns std::nullopt if the aggregate overflows; callers treat that as a
|
||||
// dry path.
|
||||
auto sum = [](auto const& col) -> std::optional<std::decay_t<decltype(*col.begin())>> {
|
||||
auto const sum = [](auto const& col) -> std::optional<std::decay_t<decltype(*col.begin())>> {
|
||||
using TResult = std::decay_t<decltype(*col.begin())>;
|
||||
if (col.empty())
|
||||
return TResult{beast::kZero};
|
||||
@@ -794,7 +794,7 @@ flow(
|
||||
setUnion(ofrsToRmOnFail, ofrsToRm);
|
||||
for (auto const& o : ofrsToRm)
|
||||
{
|
||||
if (auto ok = sb.peek(keylet::offer(o)))
|
||||
if (auto const ok = sb.peek(keylet::offer(o)))
|
||||
offerDelete(sb, ok, j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,25 +36,44 @@ public:
|
||||
};
|
||||
|
||||
static constexpr std::array<FlagMapping, 7> flagMapping = {
|
||||
{{.setFlag = tfMPTSetCanLock, .immutableFlag = lsifMPTCanLock, .ledgerFlag = lsfMPTCanLock},
|
||||
{.setFlag = tfMPTSetRequireAuth,
|
||||
.immutableFlag = lsifMPTRequireAuth,
|
||||
.ledgerFlag = lsfMPTRequireAuth},
|
||||
{.setFlag = tfMPTSetCanEscrow,
|
||||
.immutableFlag = lsifMPTCanEscrow,
|
||||
.ledgerFlag = lsfMPTCanEscrow},
|
||||
{.setFlag = tfMPTSetCanTrade,
|
||||
.immutableFlag = lsifMPTCanTrade,
|
||||
.ledgerFlag = lsfMPTCanTrade},
|
||||
{.setFlag = tfMPTSetCanTransfer,
|
||||
.immutableFlag = lsifMPTCanTransfer,
|
||||
.ledgerFlag = lsfMPTCanTransfer},
|
||||
{.setFlag = tfMPTSetCanClawback,
|
||||
.immutableFlag = lsifMPTCanClawback,
|
||||
.ledgerFlag = lsfMPTCanClawback},
|
||||
{.setFlag = tfMPTSetCanHoldConfidentialBalance,
|
||||
.immutableFlag = lsifMPTCanHoldConfidentialBalance,
|
||||
.ledgerFlag = lsfMPTCanHoldConfidentialBalance}}};
|
||||
{
|
||||
{
|
||||
.setFlag = tfMPTSetCanLock,
|
||||
.immutableFlag = lsifMPTCanLock,
|
||||
.ledgerFlag = lsfMPTCanLock,
|
||||
},
|
||||
{
|
||||
.setFlag = tfMPTSetRequireAuth,
|
||||
.immutableFlag = lsifMPTRequireAuth,
|
||||
.ledgerFlag = lsfMPTRequireAuth,
|
||||
},
|
||||
{
|
||||
.setFlag = tfMPTSetCanEscrow,
|
||||
.immutableFlag = lsifMPTCanEscrow,
|
||||
.ledgerFlag = lsfMPTCanEscrow,
|
||||
},
|
||||
{
|
||||
.setFlag = tfMPTSetCanTrade,
|
||||
.immutableFlag = lsifMPTCanTrade,
|
||||
.ledgerFlag = lsfMPTCanTrade,
|
||||
},
|
||||
{
|
||||
.setFlag = tfMPTSetCanTransfer,
|
||||
.immutableFlag = lsifMPTCanTransfer,
|
||||
.ledgerFlag = lsfMPTCanTransfer,
|
||||
},
|
||||
{
|
||||
.setFlag = tfMPTSetCanClawback,
|
||||
.immutableFlag = lsifMPTCanClawback,
|
||||
.ledgerFlag = lsfMPTCanClawback,
|
||||
},
|
||||
{
|
||||
.setFlag = tfMPTSetCanHoldConfidentialBalance,
|
||||
.immutableFlag = lsifMPTCanHoldConfidentialBalance,
|
||||
.ledgerFlag = lsfMPTCanHoldConfidentialBalance,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static bool
|
||||
checkExtraFeatures(PreflightContext const& ctx);
|
||||
|
||||
@@ -203,14 +203,15 @@ makeRunner(Workload w, std::string cfg, std::shared_ptr<RunState> rs)
|
||||
}
|
||||
|
||||
std::size_t index = state.thread_index();
|
||||
for (auto _ : state)
|
||||
for (auto const _ : state)
|
||||
{
|
||||
w.iterate(
|
||||
IterateContext{
|
||||
.rs = *rs,
|
||||
.backend = *rs->harness->backend,
|
||||
.index = index,
|
||||
.poolSize = poolSize});
|
||||
.poolSize = poolSize,
|
||||
});
|
||||
index += state.threads();
|
||||
}
|
||||
|
||||
@@ -239,7 +240,7 @@ registerWorkload(BackendConfig const& bc, Workload const& w)
|
||||
|
||||
if (!w.pinToPool)
|
||||
{
|
||||
auto rs = std::make_shared<RunState>();
|
||||
auto const rs = std::make_shared<RunState>();
|
||||
benchmark::RegisterBenchmark(name, makeRunner(w, cfg, rs))
|
||||
->RangeMultiplier(10)
|
||||
->Range(kPoolSizes.front(), kPoolSizes.back())
|
||||
@@ -258,7 +259,7 @@ registerWorkload(BackendConfig const& bc, Workload const& w)
|
||||
if (poolSize % threads != 0)
|
||||
continue;
|
||||
|
||||
auto rs = std::make_shared<RunState>();
|
||||
auto const rs = std::make_shared<RunState>();
|
||||
benchmark::RegisterBenchmark(name, makeRunner(w, cfg, rs))
|
||||
->Arg(poolSize)
|
||||
->Iterations(poolSize / threads)
|
||||
@@ -287,7 +288,7 @@ registerStoreBatch(BackendConfig const& bc)
|
||||
if (numBatches == 0)
|
||||
continue;
|
||||
|
||||
auto rs = std::make_shared<RunState>();
|
||||
auto const rs = std::make_shared<RunState>();
|
||||
benchmark::RegisterBenchmark(
|
||||
name,
|
||||
[rs, cfg](benchmark::State& state) {
|
||||
@@ -303,7 +304,7 @@ registerStoreBatch(BackendConfig const& bc)
|
||||
}
|
||||
|
||||
std::size_t index = 0;
|
||||
for (auto _ : state)
|
||||
for (auto const _ : state)
|
||||
{
|
||||
rs->harness->backend->storeBatch(batches[index % batches.size()]);
|
||||
++index;
|
||||
|
||||
@@ -192,7 +192,7 @@ Workload const kWork{
|
||||
void
|
||||
registerWorkload(BackendConfig const& bc, Workload const& w)
|
||||
{
|
||||
auto rs = std::make_shared<RunState>();
|
||||
auto const rs = std::make_shared<RunState>();
|
||||
std::string const cfg = bc.config;
|
||||
std::string name{kNamePrefix};
|
||||
name += w.name;
|
||||
@@ -206,11 +206,16 @@ registerWorkload(BackendConfig const& bc, Workload const& w)
|
||||
auto const seq = db.earliestLedgerSeq();
|
||||
|
||||
std::size_t index = 0;
|
||||
for (auto _ : state)
|
||||
for (auto const _ : state)
|
||||
{
|
||||
w.iterate(
|
||||
IterateContext{
|
||||
.rs = *rs, .db = db, .seq = seq, .index = index, .poolSize = poolSize});
|
||||
.rs = *rs,
|
||||
.db = db,
|
||||
.seq = seq,
|
||||
.index = index,
|
||||
.poolSize = poolSize,
|
||||
});
|
||||
++index;
|
||||
}
|
||||
benchmark::ClobberMemory();
|
||||
|
||||
@@ -25,7 +25,7 @@ CountedObjects::getCounts(int minimumThreshold) const
|
||||
// might be temporarily less than the actual count.
|
||||
counts.reserve(count_.load());
|
||||
|
||||
for (auto* ctr = head_.load(); ctr != nullptr; ctr = ctr->getNext())
|
||||
for (auto const* ctr = head_.load(); ctr != nullptr; ctr = ctr->getNext())
|
||||
{
|
||||
if (ctr->getCount() >= minimumThreshold)
|
||||
counts.emplace_back(ctr->getName(), ctr->getCount());
|
||||
|
||||
@@ -302,7 +302,7 @@ Logs::format(
|
||||
|
||||
// Attempt to prevent sensitive information from appearing in log files by
|
||||
// redacting it with asterisks.
|
||||
auto scrubber = [&output](char const* token) {
|
||||
auto const scrubber = [&output](char const* token) {
|
||||
auto first = output.find(token);
|
||||
|
||||
// If we have found the specified token, then attempt to isolate the
|
||||
|
||||
@@ -92,7 +92,7 @@ mallocTrim(std::string_view tag, beast::Journal journal)
|
||||
|
||||
if (journal.debug())
|
||||
{
|
||||
auto readFile = [](std::string const& path) -> std::string {
|
||||
auto const readFile = [](std::string const& path) -> std::string {
|
||||
std::ifstream ifs(path, std::ios::in | std::ios::binary);
|
||||
if (!ifs.is_open())
|
||||
return {};
|
||||
|
||||
@@ -177,7 +177,7 @@ divu10(UInt128T& u)
|
||||
// r = u - q * 10 approximately == u % 10
|
||||
auto r = static_cast<unsigned>(u - ((q << 3) + (q << 1)));
|
||||
// correction c is 1 if r >= 10 else 0
|
||||
auto c = (r + 6) >> 4;
|
||||
auto const c = (r + 6) >> 4;
|
||||
u = q + c;
|
||||
r -= c * 10;
|
||||
return r;
|
||||
@@ -657,7 +657,7 @@ Number::Guard::doRoundDown(bool& negative, T& mantissa, int& exponent) const
|
||||
{
|
||||
// Do not pushOverflow here.
|
||||
|
||||
auto r = round();
|
||||
auto const r = round();
|
||||
if (cuspRoundingFix >= MantissaRange::CuspRoundingFix::Enabled330)
|
||||
{
|
||||
// If there was any remainder, subtract 1 from the result. This is sufficient to get the
|
||||
@@ -693,7 +693,7 @@ Number::Guard::doRound(rep& drops, std::string location) const
|
||||
{
|
||||
// Do not pushOverflow here.
|
||||
|
||||
auto r = round();
|
||||
auto const r = round();
|
||||
if (r == Round::Up || (r == Round::Even && (drops & 1) == 1))
|
||||
{
|
||||
if (drops >= kMaxRep)
|
||||
@@ -1152,11 +1152,11 @@ Number::operator*=(Number const& y)
|
||||
bool const yn = y.negative_;
|
||||
int const ys = yn ? -1 : 1;
|
||||
InternalRep const ym = y.mantissa_;
|
||||
auto ye = y.exponent_;
|
||||
auto const ye = y.exponent_;
|
||||
|
||||
auto zm = UInt128T(xm) * UInt128T(ym);
|
||||
auto ze = xe + ye;
|
||||
auto zs = xs * ys;
|
||||
auto const zs = xs * ys;
|
||||
bool zn = (zs == -1);
|
||||
Guard g(kRange);
|
||||
if (zn)
|
||||
@@ -1201,8 +1201,8 @@ Number::operator/=(Number const& y)
|
||||
|
||||
bool const np = negative_;
|
||||
int const ns = (np ? -1 : 1);
|
||||
auto nm = mantissa_;
|
||||
auto ne = exponent_;
|
||||
auto const nm = mantissa_;
|
||||
auto const ne = exponent_;
|
||||
|
||||
bool const dp = y.negative_;
|
||||
int const ds = (dp ? -1 : 1);
|
||||
@@ -1557,7 +1557,7 @@ root(Number f, unsigned d)
|
||||
// Scale f into the range (0, 1) such that f's exponent is a multiple of d
|
||||
auto e = f.exponent_ + Number::mantissaLog() + 1;
|
||||
auto const di = static_cast<int>(d);
|
||||
auto ex = [e = e, di = di] // Euclidean remainder of e/d
|
||||
auto const ex = [e = e, di = di] // Euclidean remainder of e/d
|
||||
{
|
||||
int const k = (e >= 0 ? e : e - (di - 1)) / di;
|
||||
int const k2 = e - (k * di);
|
||||
@@ -1662,7 +1662,7 @@ power(Number const& f, unsigned n, unsigned d)
|
||||
|
||||
if (f == one)
|
||||
return f;
|
||||
auto g = std::gcd(n, d);
|
||||
auto const g = std::gcd(n, d);
|
||||
if (g == 0)
|
||||
throw std::overflow_error("Number::power nan");
|
||||
if (d == 0)
|
||||
|
||||
@@ -298,9 +298,9 @@ public:
|
||||
return std::isspace<std::string::value_type>(c, loc);
|
||||
};
|
||||
|
||||
auto hostFirst = std::ranges::find_if_not(str, findWhitespace);
|
||||
auto const hostFirst = std::ranges::find_if_not(str, findWhitespace);
|
||||
|
||||
auto portLast =
|
||||
auto const portLast =
|
||||
std::ranges::find_if_not(std::ranges::reverse_view(str), findWhitespace).base();
|
||||
|
||||
// This should only happen for all-whitespace strings
|
||||
@@ -318,9 +318,9 @@ public:
|
||||
return false;
|
||||
};
|
||||
|
||||
auto hostLast = std::find_if(hostFirst, portLast, findPortSeparator);
|
||||
auto const hostLast = std::find_if(hostFirst, portLast, findPortSeparator);
|
||||
|
||||
auto portFirst = std::find_if_not(hostLast, portLast, findPortSeparator);
|
||||
auto const portFirst = std::find_if_not(hostLast, portLast, findPortSeparator);
|
||||
|
||||
return make_pair(std::string(hostFirst, hostLast), std::string(portFirst, portLast));
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ inline char const*
|
||||
getAlphabet()
|
||||
{
|
||||
static constexpr char kTab[] = {
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"};
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
||||
};
|
||||
return &kTab[0];
|
||||
}
|
||||
|
||||
@@ -71,7 +72,7 @@ getInverse()
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 192-207
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 208-223
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 224-239
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // 240-255
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 240-255
|
||||
};
|
||||
return &kTab[0];
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ initAuthenticated(
|
||||
std::string const& certFile,
|
||||
std::string const& chainFile)
|
||||
{
|
||||
auto fmtError = [](boost::system::error_code ec) -> std::string {
|
||||
auto const fmtError = [](boost::system::error_code ec) -> std::string {
|
||||
return " [" + std::to_string(ec.value()) + ": " + ec.message() + "]";
|
||||
};
|
||||
|
||||
@@ -335,7 +335,8 @@ getContext(std::string cipherList)
|
||||
if (cipherList.empty())
|
||||
cipherList = kDefaultCipherList;
|
||||
|
||||
if (auto result = SSL_CTX_set_cipher_list(c->native_handle(), cipherList.c_str()); result != 1)
|
||||
if (auto const result = SSL_CTX_set_cipher_list(c->native_handle(), cipherList.c_str());
|
||||
result != 1)
|
||||
logicError("SSL_CTX_set_cipher_list failed");
|
||||
|
||||
c->use_tmp_dh({std::addressof(detail::kDefaultDh), sizeof(kDefaultDh)});
|
||||
|
||||
@@ -68,7 +68,7 @@ SecondsClockThread::run()
|
||||
{
|
||||
using namespace std::chrono;
|
||||
|
||||
auto now = Clock::now();
|
||||
auto const now = Clock::now();
|
||||
tp_ = now.time_since_epoch().count();
|
||||
auto const when = floor<seconds>(now) + 1s;
|
||||
if (cv_.wait_until(lock, when, [this] { return stop_; }))
|
||||
|
||||
@@ -45,7 +45,7 @@ isNumeric(std::string const& s)
|
||||
bool
|
||||
chop(std::string const& what, std::string& input)
|
||||
{
|
||||
auto ret = input.find(what);
|
||||
auto const ret = input.find(what);
|
||||
|
||||
if (ret != 0)
|
||||
return false;
|
||||
@@ -61,7 +61,7 @@ chopUInt(int& value, int limit, std::string& input)
|
||||
if (input.empty())
|
||||
return false;
|
||||
|
||||
auto leftIter = std::ranges::find_if_not(
|
||||
auto const leftIter = std::ranges::find_if_not(
|
||||
input, [](std::string::value_type c) { return std::isdigit(c, std::locale::classic()); });
|
||||
|
||||
std::string const item(input.begin(), leftIter);
|
||||
@@ -101,7 +101,7 @@ extractIdentifier(std::string& value, bool allowLeadingZeroes, std::string& inpu
|
||||
if (!allowLeadingZeroes && input[0] == '0')
|
||||
return false;
|
||||
|
||||
auto last =
|
||||
auto const last =
|
||||
input.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-");
|
||||
|
||||
// Must not be empty
|
||||
|
||||
@@ -343,7 +343,7 @@ public:
|
||||
|
||||
if (ec)
|
||||
{
|
||||
if (auto stream = journal_.error())
|
||||
if (auto const stream = journal_.error())
|
||||
stream << "async_send failed: " << ec.message();
|
||||
return;
|
||||
}
|
||||
@@ -377,7 +377,7 @@ public:
|
||||
buffers.reserve(data_.size());
|
||||
std::size_t size(0);
|
||||
|
||||
auto keepAlive = std::make_shared<std::deque<std::string>>(std::move(data_));
|
||||
auto const keepAlive = std::make_shared<std::deque<std::string>>(std::move(data_));
|
||||
data_.clear();
|
||||
|
||||
for (auto const& s : *keepAlive)
|
||||
@@ -432,7 +432,7 @@ public:
|
||||
|
||||
if (ec)
|
||||
{
|
||||
if (auto stream = journal_.error())
|
||||
if (auto const stream = journal_.error())
|
||||
stream << "onTimer failed: " << ec.message();
|
||||
return;
|
||||
}
|
||||
@@ -454,7 +454,7 @@ public:
|
||||
|
||||
if (socket_.connect(toEndpoint(address_), ec))
|
||||
{
|
||||
if (auto stream = journal_.error())
|
||||
if (auto const stream = journal_.error())
|
||||
stream << "Connect failed: " << ec.message();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ operator>>(std::istream& is, Endpoint& endpoint)
|
||||
}
|
||||
|
||||
boost::system::error_code ec;
|
||||
auto addr = boost::asio::ip::make_address(addrStr, ec);
|
||||
auto const addr = boost::asio::ip::make_address(addrStr, ec);
|
||||
if (ec)
|
||||
{
|
||||
is.setstate(std::ios_base::failbit);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user