/** * Spent set storage interface and implementations * Prevents double-spending by tracking used block hashes */ /** * Interface for spent set storage implementations */ export interface SpentSetStorage { /** * Check if a block hash has been spent */ has(blockHash: string): Promise; /** * Mark a block hash as spent */ add(blockHash: string): Promise; /** * Atomically add a block hash only if it doesn't already exist. * Returns true if added successfully, false if already spent. * This is critical for preventing race conditions in settlement. */ addIfNotExists(blockHash: string): Promise; } /** * In-memory implementation of SpentSetStorage * Suitable for development and testing * For production, use a persistent storage implementation */ export declare class InMemorySpentSet implements SpentSetStorage { private spentHashes; private readonly ttlMs; /** * @param ttlMs Time-to-live in milliseconds (default: 30 days) */ constructor(ttlMs?: number); has(blockHash: string): Promise; add(blockHash: string): Promise; addIfNotExists(blockHash: string): Promise; /** * Get the number of spent hashes (for testing/debugging) */ size(): number; /** * Clear all spent hashes (for testing) */ clear(): void; /** * Manual prune of expired entries */ prune(): void; } //# sourceMappingURL=spent-set.d.ts.map