diff options
author | John Wiegley <johnw@newartisans.com> | 2023-11-22 16:47:21 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2024-08-05 08:35:56 -0700 |
commit | db0661dbb51e9082e47926c31e93bdc97b491bf9 (patch) | |
tree | e60f7dc32ebe9c24cb26eeb8c8438de7e891fe6b /src/journal.cc | |
parent | e6dae78c033ea970a459b1a0ccc2f1310d1bff96 (diff) | |
download | ledger-db0661dbb51e9082e47926c31e93bdc97b491bf9.tar.gz ledger-db0661dbb51e9082e47926c31e93bdc97b491bf9.tar.bz2 ledger-db0661dbb51e9082e47926c31e93bdc97b491bf9.zip |
Add support for hash chaining to detect modifications in postings
The following details of a posting contribute to its hash:
fullname of account
string representation of amount
Each posting hashes contributes to the transaction hash, which is compromised
of:
previous transaction’s hash (as encountered in parsing order)
actual date
optional auxiliary date
optional code
payee
hashes of all postings
Note that this means that changes in the “code” or any of the comments
Diffstat (limited to 'src/journal.cc')
-rw-r--r-- | src/journal.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/journal.cc b/src/journal.cc index a6559e3d..b5ae3f1b 100644 --- a/src/journal.cc +++ b/src/journal.cc @@ -466,7 +466,7 @@ bool journal_t::remove_xact(xact_t * xact) return true; } -std::size_t journal_t::read(parse_context_stack_t& context) +std::size_t journal_t::read(parse_context_stack_t& context, bool store_hashes) { std::size_t count = 0; try { @@ -485,7 +485,7 @@ std::size_t journal_t::read(parse_context_stack_t& context) if (! current.master) current.master = master; - count = read_textual(context); + count = read_textual(context, store_hashes); if (count > 0) { if (! current.pathname.empty()) sources.push_back(fileinfo_t(current.pathname)); |