walletdb: comments. minor.

This commit is contained in:
Christopher Jeffrey 2016-11-03 15:06:06 -07:00
parent ba0e62efd7
commit 7faba4a23b
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 13 additions and 7 deletions

View File

@ -691,7 +691,7 @@ Account.prototype.syncDepth = co(function* syncDepth(receive, change, nested) {
key = this.deriveChange(change - 1);
yield this.saveKey(key);
this.change = this.deriveChange(change - 1);
this.change = key;
this.changeDepth = change;
derived = true;

View File

@ -1164,8 +1164,8 @@ WalletDB.prototype.getPathMap = co(function* getPathMap(hash) {
/**
* Save an address to the path map.
* @param {WalletID} wid
* @param {KeyRing[]} ring
* @param {Wallet} wallet
* @param {WalletKey} ring
* @returns {Promise}
*/
@ -1177,11 +1177,12 @@ WalletDB.prototype.saveKey = function saveKey(wallet, ring) {
* Save a path to the path map.
*
* The path map exists in the form of:
* - `p[address-hash] -> wids`
* - `P[wid][address-hash] -> path`
* - `p[address-hash] -> wid map`
* - `P[wid][address-hash] -> path data`
* - `r[wid][account-index][address-hash] -> dummy`
*
* @param {WalletID} wid
* @param {Path[]} path
* @param {Wallet} wallet
* @param {Path} path
* @returns {Promise}
*/
@ -1204,8 +1205,13 @@ WalletDB.prototype.savePath = co(function* savePath(wallet, path) {
this.pathMapCache.set(hash, map);
wallet.pathCache.push(hash, path);
// Address Hash -> Wallet Map
batch.put(layout.p(hash), map.toRaw());
// Wallet ID + Address Hash -> Path Data
batch.put(layout.P(wid, hash), path.toRaw());
// Wallet ID + Account Index + Address Hash -> Dummy
batch.put(layout.r(wid, path.account, hash), DUMMY);
});