The Bitcoin Core wallet is a Berkeley DB database. It consists of key-value pairs.
Salvage wallet calls BDB
DB->verify() function with the
DB_AGGRESSIVE flag which will result in it outputting any and all key-value pairs that it can find, even ones that were deleted or corrupted. This means that
-salvagewallet can find key-value pairs that normally wouldn't be in your wallet.
These key value pairs are then scanned. Anything that has a key that begins with the strings
key,
ckey,
wkey, or
mkey will be pulled out and written to a new database file. It is important to note that those records are not checked for consistency. They are simply passed through. If the rest of the key (which usually contains a public key) or the value of the pair (which may contain the private key) is corrupted,
salvagewallet will not detect it and will not be able to do anything to fix it.
salvagewallet is only for recovering key type key-value pairs from a badly corrupted wallet. It cannot help you if the public or private keys themselves are corrupted. Lastly, using
savagewallet on an non-corrupted wallet may result in that wallet becoming corrupted.