fix wallet hashes. do not request mempool on main.
This commit is contained in:
parent
48855ae56f
commit
d7db03daa3
@ -311,8 +311,10 @@ Pool.prototype._init = function _init() {
|
|||||||
|
|
||||||
if (!self.synced) {
|
if (!self.synced) {
|
||||||
// Ask loader for a mempool snapshot.
|
// Ask loader for a mempool snapshot.
|
||||||
if (self.peers.load)
|
if (self.network.requestMempool) {
|
||||||
self.peers.load.sendMempool();
|
if (self.peers.load)
|
||||||
|
self.peers.load.sendMempool();
|
||||||
|
}
|
||||||
|
|
||||||
// Ask all peers for their latest blocks.
|
// Ask all peers for their latest blocks.
|
||||||
self.sync();
|
self.sync();
|
||||||
@ -1283,6 +1285,12 @@ Pool.prototype._addPeer = function _addPeer() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a peer from any list. Drop all load requests.
|
||||||
|
* @private
|
||||||
|
* @param {Peer} peer
|
||||||
|
*/
|
||||||
|
|
||||||
Pool.prototype._removePeer = function _removePeer(peer) {
|
Pool.prototype._removePeer = function _removePeer(peer) {
|
||||||
utils.binaryRemove(this.peers.pending, peer, compare);
|
utils.binaryRemove(this.peers.pending, peer, compare);
|
||||||
utils.binaryRemove(this.peers.regular, peer, compare);
|
utils.binaryRemove(this.peers.regular, peer, compare);
|
||||||
|
|||||||
@ -695,7 +695,8 @@ Wallet.prototype.deriveInputs = function deriveInputs(tx, callback) {
|
|||||||
Wallet.prototype.getInputPaths = function getInputPaths(tx, callback) {
|
Wallet.prototype.getInputPaths = function getInputPaths(tx, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var paths = [];
|
var paths = [];
|
||||||
var hashes;
|
var hashes = [];
|
||||||
|
var hash;
|
||||||
|
|
||||||
function done() {
|
function done() {
|
||||||
utils.forEachSerial(hashes, function(hash, next, i) {
|
utils.forEachSerial(hashes, function(hash, next, i) {
|
||||||
@ -718,7 +719,9 @@ Wallet.prototype.getInputPaths = function getInputPaths(tx, callback) {
|
|||||||
if (tx instanceof bcoin.input) {
|
if (tx instanceof bcoin.input) {
|
||||||
if (!tx.coin)
|
if (!tx.coin)
|
||||||
return callback(new Error('Not all coins available.'));
|
return callback(new Error('Not all coins available.'));
|
||||||
hashes = [tx.coin.getHash('hex')];
|
hash = tx.coin.getHash('hex')
|
||||||
|
if (hash)
|
||||||
|
hashes.push(hash);
|
||||||
return done();
|
return done();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,12 +746,16 @@ Wallet.prototype.getInputPaths = function getInputPaths(tx, callback) {
|
|||||||
Wallet.prototype.getOutputPaths = function getOutputPaths(tx, callback) {
|
Wallet.prototype.getOutputPaths = function getOutputPaths(tx, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var paths = [];
|
var paths = [];
|
||||||
var hashes;
|
var hashes = [];
|
||||||
|
var hash;
|
||||||
|
|
||||||
if (tx instanceof bcoin.output)
|
if (tx instanceof bcoin.output) {
|
||||||
hashes = [tx.getHash('hex')];
|
hash = tx.getHash('hex');
|
||||||
else
|
if (hash)
|
||||||
|
hashes.push(hash);
|
||||||
|
} else {
|
||||||
hashes = tx.getOutputHashes('hex');
|
hashes = tx.getOutputHashes('hex');
|
||||||
|
}
|
||||||
|
|
||||||
utils.forEachSerial(hashes, function(hash, next, i) {
|
utils.forEachSerial(hashes, function(hash, next, i) {
|
||||||
self.getPath(hash, function(err, path) {
|
self.getPath(hash, function(err, path) {
|
||||||
@ -975,13 +982,6 @@ Wallet.prototype.sign = function sign(tx, options, callback) {
|
|||||||
var total = 0;
|
var total = 0;
|
||||||
var i, address, key, master;
|
var i, address, key, master;
|
||||||
|
|
||||||
if (Array.isArray(tx)) {
|
|
||||||
utils.forEachSerial(tx, function(tx, next) {
|
|
||||||
self.sign(tx, options, next);
|
|
||||||
}, callback);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof options === 'function') {
|
if (typeof options === 'function') {
|
||||||
callback = options;
|
callback = options;
|
||||||
options = {};
|
options = {};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user