walletdb: add path by account key.

This commit is contained in:
Christopher Jeffrey 2016-11-02 06:02:25 -07:00
parent 666e7d514f
commit d33557e2d7
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 17 additions and 0 deletions

View File

@ -23,6 +23,12 @@ layout.walletdb = {
Pp: function Pp(key) {
return key.slice(11);
},
r: function r(wid, index, hash) {
return 'r' + pad32(wid) + pad32(index) + hash;
},
rr: function rr(key) {
return key.slice(21);
},
w: function w(wid) {
return 'w' + pad32(wid);
},

View File

@ -68,6 +68,17 @@ var layout = {
Pp: function Pp(key) {
return key.toString('hex', 5);
},
r: function r(wid, index, hash) {
var key = new Buffer(1 + 4 + 4 + (hash.length / 2));
key[0] = 0x72;
key.writeUInt32BE(wid, 1, true);
key.writeUInt32BE(index, 5, true);
key.write(hash, 9, 'hex');
return key;
},
rr: function rr(key) {
return key.toString('hex', 9);
},
w: function w(wid) {
var key = new Buffer(5);
key[0] = 0x77;