Support SIN keys in wallets.

This commit is contained in:
Jeff Garzik 2013-08-17 01:11:23 -04:00
parent 60446df733
commit 52e5f3fdd4
2 changed files with 11 additions and 1 deletions

View File

@ -19,9 +19,13 @@ function ClassSpec(b) {
this.created = timeUtil.curtime();
};
SINKey.prototype.pubkeyHash = function() {
return coinUtil.sha256ripe160(this.privKey.public);
};
SINKey.prototype.storeObj = function() {
var pubKey = this.privKey.public.toString('hex');
var pubKeyHash = coinUtil.sha256ripe160(this.privKey.public);
var pubKeyHash = this.pubkeyHash();
var sin = new SIN(SIN.SIN_EPHEM, pubKeyHash);
var obj = {
created: this.created,

View File

@ -17,6 +17,7 @@ function ClassSpec(b) {
best_hash: null,
best_height: -1,
keys: [],
sin: {},
scripts: {},
};
@ -76,6 +77,11 @@ function ClassSpec(b) {
this.dirty = true;
};
Wallet.prototype.addSIN = function(sinObj) {
this.datastore.sin[sinObj.sin] = sinObj;
this.dirty = true;
};
Wallet.prototype.findKeyHash = function(pubKeyHash) {
var pkhStr = pubKeyHash.toString();