[hashcash] Re: Database purge query

  • From: BiKiKii <mail2news-admin@xxxxxxxxxxxxxx>
  • To: hashcash@xxxxxxxxxxxxx
  • Date: 22 Aug 2006 21:16:26 -0000

On Tue, 22 Aug 2006, Dr Adam Back wrote:
> Could that explain what you saw?
> 

That the stamps purged were those of default(28d+2d) expirey age.

I ran a small test.
Two cron batches to generate and check stamps.

JOB ONE:
  32,36,42,46,50,54 15 22 8 *

  hashcash -mXu -e3m -b1 -Z1 -rfoo > stamp
  copy hashcash.sdb hashcash.sd1
  hashcash -cd -X -i -p5m -e3m -g0 -b1 -rfoo -f hashcash.sdb < stamp

The commandline to check and purge is similar to the one I originally
reported, except I included the -grace period of zero.

Here is the last database for JOB ONE:
 (Note: All stamps are older than 3m+5m and none have been purged)

  last_purged 060822205036
  1:1:0608222032:foo::M3BxkzWw+Zq7VGGY:0 180
  1:1:0608222036:foo::BYRgaGH1CeKOzK6V:0 180
  1:1:0608222042:foo::gz9tiXRsREsPEcux:0 180
  1:1:0608222046:foo::YhqbQszHlf0K4FZJ:0 180
  1:1:0608222050:foo::8MUIRydJAjgCz5jk:6 180
  1:1:0608222054:foo::ttRYMpyDUIpNRln7:0 180


JOB TWO:
  1 16 22 8 *

  hashcash -mXu -e3m -b1 -Z1 -rfoo > stamp
  copy hashcash.sdb hashcash.sd2
  hashcash -cd -X -i -e3m -p5m -g0 -b1 -rfoo -f hashcash.sdb < stamp

The difference in the command line is -expirey before -purge.

This is the resulting database from JOB TWO:

  last_purged 060822210136
  1:1:0608222101:foo::AQ9iFZQ8vn0T+Adf:1 180


> Note even if the -e is after the -p, it should work though in a
> different way.
> 
> At the time the stamp is checked the expiry information will be
> written to the hashcash.sdb file.  (The 1209600 seconds = 14d).
> 
> Then every 7 days the purge will happen, and because the -e doesnt
> apply to the -p if it comes after it, there will be no explicit expiry
> argument given to the purge.  In this scenario the purge takes the
> expiry information from hashcash.sdb.
> 
> I tested this also and it worked for me, however I didnt have the -p
> 7d, I had -p now so I didnt have to wait.  I think if the previous
> purge happens just before you accept a stamp, and including grace
> period, a stamp could legitimately live in the db for up to: 7+14+2 =
> 23 days, right?
> 
> Could that explain what you saw?
> 
> On Mon, Aug 21, 2006 at 09:31:18PM -0000, BiKiKii wrote:
> > On Mon, 21 Aug 2006, Dr Adam Back wrote:
> > 
> > This is the information needed:
> > 
> > >Note also for the -e to apply to the purge, that option must come
> > >before the -p option.  (Otherwise it applies to the -c etc).
> > >
> > 
> > Rewriting the command with the -expirey before the -purge
> > (and changing purge to 1 day for testing)...
> > 
> > hashcash -cd -X -i -q -e 14d -p 1d -b 27 -r bikikii -f hashcash.sdb < "%x%"
> > 
> > has the desired result:
> > 
> > last_purged 060821203814
> > 1:27:060806:bikikii::iYNtHsxuIOl3C9B1:0000000005Gj1R 1209600
> > 1:27:060806:bikikii::Ezp/CKbBgXs1YJLM:000000000A4PRp 1209600
> > 1:27:060807:bikikii::doOjfbu8jzc4eCLq:0000000005TxYf 1209600
> > 
> > Now back to 7 days for -purge and see what happens next week.
> > 
> > >Seems to work for me.  Bear in mind that there is a default grace
> > >period of 2days, so stamps will not actually exire until 16 days after
> > >issue if you say -e 14d.  You can override that with -g 0 if you dont
> > >want any grace period.
> > >
> > >Note also for the -e to apply to the purge, that option must come
> > >before the -p option.  (Otherwise it applies to the -c etc).
> > >
> > >Using your stamp file if I do this:
> > >
> > >hashcash -g 0 -p now -t 060731
> > >
> > >then the stamp file afterwards holds:
> > >
> > >last_purged 060730230000
> > >1:27:060717:bikikii::ATSrpfAr7W1prZUO:00000000055kh+ 1209600
> > >
> > >(if no -e is given the e value given at time of checking (-c) is
> > >stored in the db and used.  ie the 1209600 == 14days.)
> > >
> > >On Fri, Aug 18, 2006 at 08:25:10PM -0500, BiKiKii wrote:
> > >> [hashcash-1.22 W32 console]
> > >> 
> > >> Is there something wrong with the below commandline?
> > >> The commandline is abbreviated but all the options are listed.
> > >> The option of "-f" is used as the database is located at a different
> > >> drive:\directory location than the executable. 
> > >> 
> > >> Too many or incompatible options?
> > >> 
> > >> I expect it to purge the database of expired stamps.
> > >> Stamps that are older than 14 days. But it only purges
> > >> those stamps older than 28 days.
> > >> 
> > >> 
> > >> hashcash -cd -X -i -q -p 7d -e 14d -b 27 -r bikikii -f hashcash.sdb < 
> > >> "%x%"
> > >> 
> > >> last_purged 060812095308
> > >> 1:27:060716:bikikii::LSQ1tRGm+Opf6Ish:0000000007QTsq 1209600
> > >> 1:27:060717:bikikii::ATSrpfAr7W1prZUO:00000000055kh+ 1209600
> > >> 1:27:060716:bikikii::/KM9u7rGJMXBr0wW:0X63s 1209600

Other related posts: