-
Notifications
You must be signed in to change notification settings - Fork 10
feat: repeat token claim as long as there are outstanding tokens #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v1.0-dev
Are you sure you want to change the base?
Changes from all commits
29afd79
37e29df
28d83c4
86240ce
02ab340
eecf9a7
044ad65
c1bd76e
2a75499
db1be03
bf5aba0
a2519eb
96bb5b6
1d3d035
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,6 +114,39 @@ impl Database { | |
| Ok(()) | ||
| } | ||
|
|
||
| #[allow(dead_code)] // May be used for caching remote identities from network queries | ||
| pub fn insert_remote_identity_if_not_exists( | ||
| &self, | ||
| identifier: &Identifier, | ||
| qualified_identity: Option<&QualifiedIdentity>, | ||
| app_context: &AppContext, | ||
| ) -> rusqlite::Result<()> { | ||
| let id = identifier.to_vec(); | ||
| let alias = qualified_identity.and_then(|qi| qi.alias.clone()); | ||
| let identity_type = | ||
| qualified_identity.map_or("".to_string(), |qi| format!("{:?}", qi.identity_type)); | ||
| let data = qualified_identity.map(|qi| qi.to_bytes()); | ||
|
|
||
| let network = app_context.network.to_string(); | ||
|
|
||
| // Check if the identity already exists | ||
| let conn = self.conn.lock().unwrap(); | ||
| let mut stmt = | ||
| conn.prepare("SELECT COUNT(*) FROM identity WHERE id = ? AND network = ?")?; | ||
| let count: i64 = stmt.query_row(params![id, network], |row| row.get(0))?; | ||
|
|
||
| // If the identity doesn't exist, insert it | ||
| if count == 0 { | ||
| self.execute( | ||
| "INSERT INTO identity (id, data, is_local, alias, identity_type, network) | ||
| VALUES (?, ?, 0, ?, ?, ?)", | ||
| params![id, data, alias, identity_type, network], | ||
| )?; | ||
|
Comment on lines
+133
to
+144
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: rg -n "fn execute" src/database/identities.rs -A 10Repository: dashpay/dash-evo-tool Length of output: 47 🏁 Script executed: # Find the Database struct and impl block
rg -n "impl.*Database|struct Database" src/database/ -A 5 --type rustRepository: dashpay/dash-evo-tool Length of output: 7347 🏁 Script executed: # Look at the full context of the method in question
sed -n '117,148p' src/database/identities.rsRepository: dashpay/dash-evo-tool Length of output: 1362 🏁 Script executed: # Check other methods that use self.execute() to see if they also lock conn first
rg -n "self\.execute|self\.conn\.lock" src/database/identities.rs --type rust -B 2 -A 2Repository: dashpay/dash-evo-tool Length of output: 4126 🏁 Script executed: rg -n "fn execute\(" src/database/ --type rust -A 15 | head -60Repository: dashpay/dash-evo-tool Length of output: 47 🏁 Script executed: # Specifically look in mod.rs for the execute method
cat src/database/mod.rsRepository: dashpay/dash-evo-tool Length of output: 4348 🏁 Script executed: # Verify the proposed fix works by checking similar patterns in the codebase
# Look for methods that lock conn, then use conn.execute() directly
rg -n "let conn = self.conn.lock" src/database/identities.rs -A 10 | grep -E "(conn\.execute|conn\.prepare)"Repository: dashpay/dash-evo-tool Length of output: 583 🏁 Script executed: # Check if 'status' column has a default or is NOT NULL in the schema
rg -n "CREATE TABLE.*identity" src/database/ -A 20 --type rustRepository: dashpay/dash-evo-tool Length of output: 4501 Critical deadlock: Line 133 acquires Use 🐛 Proposed fix: use local connection guard for the INSERT // If the identity doesn't exist, insert it
if count == 0 {
- self.execute(
+ conn.execute(
"INSERT INTO identity (id, data, is_local, alias, identity_type, network)
VALUES (?, ?, 0, ?, ?, ?)",
params![id, data, alias, identity_type, network],
)?;
}🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| /// Returns all local identities for the current network. | ||
| /// | ||
| /// Stops on the first corrupted identity blob and returns an error. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: dashpay/dash-evo-tool
Length of output: 3259
Remove unused
ClaimedTokens(FeeResult)variant.The
ClaimedTokensvariant is dead code—it's defined but never used anywhere in the codebase. The active variant isTokensClaimed(TokenAmount), which is returned inclaim_tokens.rsand matched inclaim_tokens_screen.rs. Since they serve different semantic purposes (fee tracking vs. amount tracking), removeClaimedTokensentirely rather than renaming.🤖 Prompt for AI Agents