upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main.h b/src/main.h
index a50485f..1d9efac 100644
--- a/src/main.h
+++ b/src/main.h
@@ -124,6 +124,32 @@ FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszM
124FILE* AppendBlockFile(unsigned int& nFileRet); 124FILE* AppendBlockFile(unsigned int& nFileRet);
125bool AddKey(const CKey& key); 125bool AddKey(const CKey& key);
126vector<unsigned char> GenerateNewKey(); 126vector<unsigned char> GenerateNewKey();
127
128// --- Key pool -------------------------------------------------------------
129//
130// A backup of this wallet only ever contained the keys that existed the moment
131// it was taken. Mine a block or take a new address afterwards and the coin
132// lands on a key the backup has never heard of -- it is on the chain, and the
133// file you carefully put away cannot spend it. The LEIA-ME shipped with a
134// warning about this, which is an admission, not a fix.
135//
136// Keys are now generated a hundred at a time and handed out one by one, so a
137// backup covers the next hundred addresses this node will use. It is the same
138// answer Bitcoin arrived at, and it is not deterministic derivation (#47) --
139// it just buys back the distance between a backup and the next mistake.
140static const int KEYPOOL_SIZE = 100;
141extern CCriticalSection cs_keyPool;
142extern map<int64, vector<unsigned char> > mapKeyPool;
143
144// Fill the pool back up to KEYPOOL_SIZE. Every key it creates is written to
145// wallet.dat before it is offered to anybody.
146void TopUpKeyPool();
147
148// Hand out the oldest unused key. Falls back to generating one on the spot if
149// the pool cannot be filled, which is exactly what this code did before the
150// pool existed -- a wallet that cannot pre-generate should still be able to
151// mine.
152vector<unsigned char> GetKeyFromPool();
127bool AddToWallet(const CWalletTx& wtxIn); 153bool AddToWallet(const CWalletTx& wtxIn);
128void ReacceptWalletTransactions(); 154void ReacceptWalletTransactions();
129// Returns how many wallet transactions the chain corrected. 155// Returns how many wallet transactions the chain corrected.