feat: Add separate message for conflict claim removalImplement removeConflictDomainClaim: message type to distinguish betweenfull domain cleanup and conflict claim removal, ensuring other peers'claims are preserved when removing conflicting claims.- Add sendConflictClaimRemoval() function for notification broadcasting- Add handler for removeConflictDomainClaim: messages that updates consensus but does NOT remove other peers' claims- Modify removal logic to conditionally broadcast based on claimant status: - Resolved claimants: broadcast remove_domain: (full cleanup) - Non-resolved claimants: broadcast removeConflictDomainClaim: (notification only)- Update admin routes and SDK to use conditional broadcastingPrevents cross-peer claim deletion when removing conflict claims whilemaintaining proper consensus updates and full cleanup functionality.
This commit is contained in:
@@ -205,17 +205,24 @@ async function handleDomainsRoutes(req, res) {
|
||||
// Full removal: user is the resolved claimant
|
||||
logInfo('Admin', `User is resolved claimant for ${domain}, performing full cleanup`);
|
||||
await atomicDomainCleanup(domain);
|
||||
|
||||
// Broadcast full removal request (triggers other peers to clean up their claims)
|
||||
if (state.sendRemovalRequest) {
|
||||
state.sendRemovalRequest(domain);
|
||||
}
|
||||
} else {
|
||||
// Partial removal: user has claim but isn't the resolved claimant
|
||||
// Partial removal: user has claim but isn't the resolved claimant (conflict scenario)
|
||||
// This includes cases where:
|
||||
// - Consensus is not resolved
|
||||
// - User is not the resolved claimant (conflict scenario)
|
||||
// - Resolved claimant is null/undefined
|
||||
logInfo('Admin', `User is NOT resolved claimant for ${domain} (status=${consensusState.status}, resolvedClaimant=${consensusState.resolvedClaimant}), removing only own claim and votes`);
|
||||
await removeOwnClaimAndVotes(domain, localWriter);
|
||||
}
|
||||
if (state.sendRemovalRequest) {
|
||||
state.sendRemovalRequest(domain);
|
||||
|
||||
// Broadcast conflict claim removal notification (does NOT trigger other peers to remove)
|
||||
if (state.sendConflictClaimRemoval) {
|
||||
state.sendConflictClaimRemoval(domain);
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup hash preferences if domain was removed
|
||||
|
||||
@@ -205,17 +205,24 @@ async function handleDomainsRoutes(req, res) {
|
||||
// Full removal: user is the resolved claimant
|
||||
logInfo('Admin', `User is resolved claimant for ${domain}, performing full cleanup`);
|
||||
await atomicDomainCleanup(domain);
|
||||
|
||||
// Broadcast full removal request (triggers other peers to clean up their claims)
|
||||
if (state.sendRemovalRequest) {
|
||||
state.sendRemovalRequest(domain);
|
||||
}
|
||||
} else {
|
||||
// Partial removal: user has claim but isn't the resolved claimant
|
||||
// Partial removal: user has claim but isn't the resolved claimant (conflict scenario)
|
||||
// This includes cases where:
|
||||
// - Consensus is not resolved
|
||||
// - User is not the resolved claimant (conflict scenario)
|
||||
// - Resolved claimant is null/undefined
|
||||
logInfo('Admin', `User is NOT resolved claimant for ${domain} (status=${consensusState.status}, resolvedClaimant=${consensusState.resolvedClaimant}), removing only own claim and votes`);
|
||||
await removeOwnClaimAndVotes(domain, localWriter);
|
||||
}
|
||||
if (state.sendRemovalRequest) {
|
||||
state.sendRemovalRequest(domain);
|
||||
|
||||
// Broadcast conflict claim removal notification (does NOT trigger other peers to remove)
|
||||
if (state.sendConflictClaimRemoval) {
|
||||
state.sendConflictClaimRemoval(domain);
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup hash preferences if domain was removed
|
||||
|
||||
+12
-7
@@ -669,14 +669,19 @@ const sdk = {
|
||||
if (isResolvedClaimant) {
|
||||
// Full removal: user is the resolved claimant
|
||||
await atomicDomainCleanup(domain);
|
||||
} else {
|
||||
// Partial removal: user has claim but isn't the resolved claimant
|
||||
await removeOwnClaimAndVotes(domain, localWriter);
|
||||
}
|
||||
|
||||
// Broadcast removal request to peers if available
|
||||
if (state.sendRemovalRequest) {
|
||||
state.sendRemovalRequest(domain);
|
||||
// Broadcast full removal request (triggers other peers to clean up their claims)
|
||||
if (state.sendRemovalRequest) {
|
||||
state.sendRemovalRequest(domain);
|
||||
}
|
||||
} else {
|
||||
// Partial removal: user has claim but isn't the resolved claimant (conflict scenario)
|
||||
await removeOwnClaimAndVotes(domain, localWriter);
|
||||
|
||||
// Broadcast conflict claim removal notification (does NOT trigger other peers to remove)
|
||||
if (state.sendConflictClaimRemoval) {
|
||||
state.sendConflictClaimRemoval(domain);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user