broadcast option.
This commit is contained in:
parent
41a864d130
commit
b85a98b4ca
4
bin/node
4
bin/node
@ -9,12 +9,12 @@ process.on('uncaughtException', function(err) {
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
var node = bcoin.fullnode({
|
||||
// passphrase: 'node',
|
||||
var node = new bcoin.fullnode({
|
||||
prune: process.argv.indexOf('--prune') !== -1,
|
||||
useCheckpoints: process.argv.indexOf('--checkpoints') !== -1,
|
||||
listen: process.argv.indexOf('--listen') !== -1,
|
||||
selfish: process.argv.indexOf('--selfish') !== -1,
|
||||
broadcast: process.argv.indexOf('--broadcast') !== -1,
|
||||
mine: process.argv.indexOf('--mine') !== -1
|
||||
});
|
||||
|
||||
|
||||
@ -87,6 +87,7 @@ Fullnode.prototype._init = function _init() {
|
||||
witness: network.witness,
|
||||
listen: this.options.listen,
|
||||
selfish: this.options.selfish,
|
||||
broadcast: this.options.broadcast,
|
||||
spv: false
|
||||
});
|
||||
|
||||
|
||||
@ -229,9 +229,23 @@ Pool.prototype.connect = function connect() {
|
||||
if (this.connected)
|
||||
return;
|
||||
|
||||
if (this.mempool && this.options.broadcast) {
|
||||
this.mempool.on('tx', function(tx) {
|
||||
self.broadcast(tx);
|
||||
if (this.options.broadcast) {
|
||||
if (this.mempool) {
|
||||
this.mempool.on('tx', function(tx) {
|
||||
self.broadcast(tx);
|
||||
});
|
||||
}
|
||||
|
||||
// Normally we would also broadcast
|
||||
// competing chains, but we want to
|
||||
// avoid getting banned if an evil
|
||||
// miner sends us an invalid competing
|
||||
// chain that we can't connect and
|
||||
// verify yet.
|
||||
this.chain.on('block', function(block) {
|
||||
if (!self.synced)
|
||||
return;
|
||||
self.broadcast(block);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user