• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tari-project / tari / 19227006544

10 Nov 2025 09:31AM UTC coverage: 51.608% (-7.9%) from 59.471%
19227006544

push

github

web-flow
feat: add deterministic transaction id (#7541)

Description
---
Added deterministic transaction IDs, which are an 8-byte (u64) hash
based on the transaction output hash in question and the wallet view
key.
- Any scanned or recovered wallet output will have the same transaction
ID across view or spend wallets.
- Sender wallets will be able to calculate the transaction ID for
receiver wallets if they need to, for that specific output.
- Sender wallets will use their change output as the determining output
hash for the transaction; this will result in the same transaction ID
being allocated upon wallet recovery. In the case of no change output,
the hash of the first ordered output will be used for the transaction
ID.
- For coin split transactions, the hash of the first ordered output will
be used for the transaction ID.

Fixed the issue with the Windows test build target link:
```
: error LNK2019: unresolved external symbol __imp_InitializeSecurityDescriptor referenced in function mdb_env_setup_locks
: error LNK2019: unresolved external symbol __imp_SetSecurityDescriptorDacl referenced in function mdb_env_setup_lock
```

Fixes #7485.

Motivation and Context
---
See #7485.

How Has This Been Tested?
---
Added unit tests.
Performed system-level testing.

What process can a PR reviewer use to test or verify this change?
---
Code review.
System-level testing.

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->


<!-- This is an auto-generated comm... (continued)

52 of 1260 new or added lines in 14 files covered. (4.13%)

9213 existing lines in 93 files now uncovered.

59188 of 114687 relevant lines covered (51.61%)

8172.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

36.84
/base_layer/transaction_components/src/transaction_components/transaction_kernel_version.rs
1
// Copyright 2022 The Tari Project
2
// SPDX-License-Identifier: BSD-3-Clause
3

4
use std::convert::TryFrom;
5

6
use borsh::{BorshDeserialize, BorshSerialize};
7
use serde::{Deserialize, Serialize};
8

9
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, PartialOrd, BorshSerialize, BorshDeserialize)]
×
10
#[repr(u8)]
11
#[borsh(use_discriminant = true)]
12
pub enum TransactionKernelVersion {
13
    V0 = 0,
14
}
15

16
impl TransactionKernelVersion {
17
    pub fn get_current_version() -> Self {
947✔
18
        Self::V0
947✔
19
    }
947✔
20

21
    pub fn as_u8(self) -> u8 {
×
22
        self as u8
×
23
    }
×
24
}
25

26
impl Default for TransactionKernelVersion {
27
    fn default() -> Self {
×
28
        Self::get_current_version()
×
29
    }
×
30
}
31

32
impl TryFrom<u8> for TransactionKernelVersion {
33
    type Error = String;
34

35
    fn try_from(value: u8) -> Result<Self, Self::Error> {
12✔
36
        match value {
12✔
37
            0 => Ok(TransactionKernelVersion::V0),
12✔
UNCOV
38
            v => Err(format!("Unknown kernel version {v}!")),
×
39
        }
40
    }
12✔
41
}
42

43
#[cfg(test)]
44
mod test {
45
    use super::*;
46

47
    #[test]
UNCOV
48
    fn test_try_from() {
×
UNCOV
49
        assert_eq!(TransactionKernelVersion::try_from(0), Ok(TransactionKernelVersion::V0));
×
UNCOV
50
        assert!(TransactionKernelVersion::try_from(1).is_err());
×
UNCOV
51
    }
×
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc