Re: purging double spend db

Adam Back <[email protected]>
Newsgroups gmane.mail.spam.hashcash
Message-ID <[email protected]>
On Fri, Oct 08, 2004 at 12:16:08PM -0400, Atom 'Smasher' wrote:
> On Fri, 8 Oct 2004, Adam Back wrote:
> >If this is all inconvenient for what you are doing or anyway for 
> >completeness of control I maybe could make -e available with -p and make 
> >it purge all stamps (or those matched by the optional -j pattern) as if 
> >they were originally given expiry period given with -e.  Ie the -p flag 
> >given with -e overrides the one given with -cd.
> ===================
> 
> so, if that were implemented, 

In fact I implemented between the previous email and now.  Quite easy
to add :-)  (Not released yet).

> then i could expire spent stamps after X days?

Sure.  It would be just as if you'd given -e X when spending them.

In fact you can already in effect.

So say X days is your target (default is 28 days).

Already you can do this as you spend them:

	hashcash -cdb20 -r [email protected] -e Xd

and every day say from cron:

	hashcash -p now

or add to every invocation the purge option:

	hashcash -cdb20 -r [email protected] -e Xd -p 1d

which saves needing to use cron.

QED.


Now with this new feature you could in addition change your mind and
override the period you gave:

Eg. say you had been doing:

	hashcash -cdb20 -r  [email protected] -e Yd

Then 

	hashcash -p now

will only expire them as they need to be expired according to period
Y.  But this:

	hashcash -p now -e Xd

would expire them as if you gave X when you spent them (overriding the
Ydays you gave).

In fact I think this would be equivalent to:

	hashcash -p now -t +Nd

where N = Y-X (or -t -Md where M=X-Y).

So those two commands would do roughly the same thing.

> but for now, if i understand this correctly, a purge will get rid of
> spent stamps only after they're expired;

right.  Well you can override it to to delete them even though they
aren't expired with "-p now -k" which deletes also unexpired stamps.

> this is determined at the time they're spent, using the "-e" option;
> and by default stamps older than 2419200s (28d) will be purged.

Yes.

> where does the 2d grace period come into play when expiring spent
> stamps?

Well I need to not remove them from the double-spend db until they
would be considered invalid due to age.  This means I should keep
things in the double-spend db 2days longer (default grace period) than
you would otherwise think.

In fact the current version (1.12 and earlier) do not do this.  That
is the other change I just made which will release as 1.13 presently.

(If you don't do this you open a window where a spammer could re-spend
spent stamps after they've been purged but before they would be
considered invalid).

You can work around this by adding -t -2d to the purge line.

Adam
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.