wallet: sign refactor.
This commit is contained in:
parent
990d5c2baf
commit
d7ac63755f
@ -1395,6 +1395,7 @@ Wallet.prototype.scriptInputs = function scriptInputs(tx, callback) {
|
|||||||
|
|
||||||
Wallet.prototype.sign = function sign(tx, options, callback) {
|
Wallet.prototype.sign = function sign(tx, options, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var passphrase, timeout, index, type;
|
||||||
|
|
||||||
if (typeof options === 'function') {
|
if (typeof options === 'function') {
|
||||||
callback = options;
|
callback = options;
|
||||||
@ -1404,15 +1405,20 @@ Wallet.prototype.sign = function sign(tx, options, callback) {
|
|||||||
if (typeof options === 'string' || Buffer.isBuffer(options))
|
if (typeof options === 'string' || Buffer.isBuffer(options))
|
||||||
options = { passphrase: options };
|
options = { passphrase: options };
|
||||||
|
|
||||||
|
passphrase = options.passphrase;
|
||||||
|
timeout = options.timeout;
|
||||||
|
index = options.index;
|
||||||
|
type = options.type;
|
||||||
|
|
||||||
this.deriveInputs(tx, function(err, rings) {
|
this.deriveInputs(tx, function(err, rings) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|
||||||
self.unlock(options.passphrase, options.timeout, function(err, master) {
|
self.unlock(passphrase, timeout, function(err, master) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|
||||||
self._sign(rings, master, tx, options.index, options.type, callback);
|
self._sign(rings, master, tx, index, type, callback);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user