add private key in Wallet call to network start
This commit is contained in:
parent
b9ecab9b92
commit
8e81e9108f
2 changed files with 11 additions and 2 deletions
|
|
@ -236,6 +236,10 @@ Wallet.prototype.getMyCopayerId = function() {
|
||||||
return this.getCopayerId(0);
|
return this.getCopayerId(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Wallet.prototype.getMyCopayerIdPriv = function() {
|
||||||
|
return this.privateKey.getIdPriv();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
Wallet.prototype.getSecret = function() {
|
Wallet.prototype.getSecret = function() {
|
||||||
var pubkeybuf = new Buffer(this.getMyCopayerId(), 'hex');
|
var pubkeybuf = new Buffer(this.getMyCopayerId(), 'hex');
|
||||||
|
|
@ -271,8 +275,10 @@ Wallet.prototype.netStart = function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
var myId = self.getMyCopayerId();
|
var myId = self.getMyCopayerId();
|
||||||
|
var myIdPriv = self.getMyCopayerIdPriv();
|
||||||
var startOpts = {
|
var startOpts = {
|
||||||
copayerId: myId,
|
copayerId: myId,
|
||||||
|
privkey: myIdPriv,
|
||||||
token: self.token,
|
token: self.token,
|
||||||
maxPeers: self.totalCopayers
|
maxPeers: self.totalCopayers
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,8 @@ Network.prototype._addConnectedCopayer = function(copayerId, isInbound) {
|
||||||
|
|
||||||
Network.prototype._onData = function(enchex, isInbound, peerId) {
|
Network.prototype._onData = function(enchex, isInbound, peerId) {
|
||||||
var sig, payload;
|
var sig, payload;
|
||||||
var encbuf = new Buffer(enchex, 'hex');
|
var encUint8Array = new Uint8Array(enchex);
|
||||||
|
var encbuf = new Buffer(encUint8Array);
|
||||||
|
|
||||||
var privkey = this.privkey;
|
var privkey = this.privkey;
|
||||||
|
|
||||||
|
|
@ -304,7 +305,9 @@ Network.prototype.start = function(opts, openCallback) {
|
||||||
|
|
||||||
if (this.started) return openCallback();
|
if (this.started) return openCallback();
|
||||||
|
|
||||||
this.privkey = opts.privkey;
|
if (!this.privkey)
|
||||||
|
this.privkey = opts.privkey;
|
||||||
|
|
||||||
this.maxPeers = opts.maxPeers || this.maxPeers;
|
this.maxPeers = opts.maxPeers || this.maxPeers;
|
||||||
|
|
||||||
if (opts.token)
|
if (opts.token)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue