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);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
var node = bcoin.fullnode({
|
var node = new bcoin.fullnode({
|
||||||
// passphrase: 'node',
|
|
||||||
prune: process.argv.indexOf('--prune') !== -1,
|
prune: process.argv.indexOf('--prune') !== -1,
|
||||||
useCheckpoints: process.argv.indexOf('--checkpoints') !== -1,
|
useCheckpoints: process.argv.indexOf('--checkpoints') !== -1,
|
||||||
listen: process.argv.indexOf('--listen') !== -1,
|
listen: process.argv.indexOf('--listen') !== -1,
|
||||||
selfish: process.argv.indexOf('--selfish') !== -1,
|
selfish: process.argv.indexOf('--selfish') !== -1,
|
||||||
|
broadcast: process.argv.indexOf('--broadcast') !== -1,
|
||||||
mine: process.argv.indexOf('--mine') !== -1
|
mine: process.argv.indexOf('--mine') !== -1
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -87,6 +87,7 @@ Fullnode.prototype._init = function _init() {
|
|||||||
witness: network.witness,
|
witness: network.witness,
|
||||||
listen: this.options.listen,
|
listen: this.options.listen,
|
||||||
selfish: this.options.selfish,
|
selfish: this.options.selfish,
|
||||||
|
broadcast: this.options.broadcast,
|
||||||
spv: false
|
spv: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -229,9 +229,23 @@ Pool.prototype.connect = function connect() {
|
|||||||
if (this.connected)
|
if (this.connected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.mempool && this.options.broadcast) {
|
if (this.options.broadcast) {
|
||||||
this.mempool.on('tx', function(tx) {
|
if (this.mempool) {
|
||||||
self.broadcast(tx);
|
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