Skip to content

Commit

Permalink
Add CWalletScanState
Browse files Browse the repository at this point in the history
  • Loading branch information
iamunick committed Jun 6, 2014
1 parent d47193f commit ca9673a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/walletdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,23 @@ CWalletDB::ReorderTransactions(CWallet* pwallet)
return DB_LOAD_OK;
}

class CWalletScanState {
public:
unsigned int nKeys;
unsigned int nCKeys;
unsigned int nKeyMeta;
bool fIsEncrypted;
bool fAnyUnordered;
int nFileVersion;
vector<uint256> vWalletUpgrade;

CWalletScanState() {
nKeys = nCKeys = nKeyMeta = 0;
fIsEncrypted = false;
fAnyUnordered = false;
nFileVersion = 0;
}
};

bool
ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
Expand Down
31 changes: 31 additions & 0 deletions src/walletdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,37 @@ enum DBErrors
DB_NEED_REWRITE
};

class CKeyMetadata
{
public:
static const int CURRENT_VERSION=1;
int nVersion;
int64 nCreateTime; // 0 means unknown

CKeyMetadata()
{
SetNull();
}
CKeyMetadata(int64 nCreateTime_)
{
nVersion = CKeyMetadata::CURRENT_VERSION;
nCreateTime = nCreateTime_;
}

IMPLEMENT_SERIALIZE
(
READWRITE(this->nVersion);
nVersion = this->nVersion;
READWRITE(nCreateTime);
)

void SetNull()
{
nVersion = CKeyMetadata::CURRENT_VERSION;
nCreateTime = 0;
}
};

/** Access to the wallet database (wallet.dat) */
class CWalletDB : public CDB
{
Expand Down

0 comments on commit ca9673a

Please sign in to comment.