on CDB::Rewrite()

on CDB::Rewrite()
2013-10-04  3:23 ` Olivier Langlois
  
From: Ron @ 2013-10-03  3:16 UTC (permalink / raw)
  To: bitcoin-development

[-- Attachment #1: Type: text/plain, Size: 988 bytes --]

I only bring this up here since I can't raise https://bitcointalk.org? Perhaps it runs on the silk road servers:)

Upon looking at the 0.8.5 & earlier code for CDB:Rewrite(), in the files db.h and db.cpp, you will notice that in db.h it is declared bool static, but in db.cpp it isn't. Is this a problem? Or a feature? Or nothing at all?


Furthermore, it is called only in wallet.cpp -->CWallet::EncryptWallet() but its return value is ignored? Again, intentional or a bug or a feature or a ...?
Now CWallet::EncryptWallet() is called by AskPassphraseDialog::accept() and WalletModel::setWalletEncrypted()and they seem very interested in what  CWallet::EncryptWallet() returns. Could this be involved in some old issue with wallet encryption on bitcoin-qt 0.8.1?

There seems to be plenty of this kind of "suspicious" code to ferret about in, with one's IDE during quiet moments. Amusing is to follow return 0 and return 1 to try and infer their meaning, their intent?


Ron

[-- Attachment #2: Type: text/html, Size: 2301 bytes --]

 permalink raw reply	[|nested]
2013-10-03  3:16 [Bitcoin-development] on CDB::Rewrite() Ron

  
From: Olivier Langlois @ 2013-10-04  3:23 UTC ( / )
  To: Ron;  bitcoin-development


> Upon looking at the 0.8.5 & earlier code for CDB:Rewrite(), in the
> files db.h and db.cpp, you will notice that in db.h it is declared
> bool static, but in db.cpp it isn't. Is this a problem? Or a feature?
> Or nothing at all?

It is perfect C++ code.

> Furthermore, it is called only in wallet.cpp
> -->CWallet::EncryptWallet() but its return value is ignored? Again,
> intentional or a bug or a feature or a ...?

possibly a minor bug. Minor because over 99% of the time it is called, the Rewrite() function will succeed.

Maybe CWallet::EncryptWallet() should return false to its callers when
CDB::Rewrite fails.