Pass fcoin Block template
This commit is contained in:
parent
b13b4f667b
commit
978679cad7
@ -90,7 +90,7 @@ P2P.prototype.getP2PBlock = function(opts, callback) {
|
|||||||
|
|
||||||
self.once(opts.blockHash, callback);
|
self.once(opts.blockHash, callback);
|
||||||
|
|
||||||
peer.sendMessage(self.messages.GetBlocks(blockFilter));
|
peer.sendMessage(self.messages.GetBlocks(blockFilter, { Block: BcoinBlock }));
|
||||||
};
|
};
|
||||||
|
|
||||||
P2P.prototype.getHeaders = function(filter) {
|
P2P.prototype.getHeaders = function(filter) {
|
||||||
@ -278,7 +278,7 @@ P2P.prototype._initP2P = function() {
|
|||||||
if (this.node.network === 'regtest') {
|
if (this.node.network === 'regtest') {
|
||||||
Networks.enableRegtest();
|
Networks.enableRegtest();
|
||||||
}
|
}
|
||||||
this.messages = new p2p.Messages({ network: Networks.get(this.node.network), Transaction: BcoinTx });
|
this.messages = new p2p.Messages({ network: Networks.get(this.node.network), Transaction: BcoinTx, Block: BcoinBlock });
|
||||||
this._peerHeights = [];
|
this._peerHeights = [];
|
||||||
this._peers = [];
|
this._peers = [];
|
||||||
this._peerIndex = 0;
|
this._peerIndex = 0;
|
||||||
@ -306,10 +306,9 @@ P2P.prototype._initPubSub = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
P2P.prototype._onPeerBlock = function(peer, message) {
|
P2P.prototype._onPeerBlock = function(peer, message) {
|
||||||
let block = BcoinBlock.fromRaw(message.block.toBuffer())
|
this._blockCache.set(message.block.rhash(), message.block);
|
||||||
this._blockCache.set(block.rhash(), block);
|
this.emit(message.block.rhash(), message.block);
|
||||||
this.emit(block.rhash(), block);
|
this._broadcast(this.subscriptions.block, 'p2p/block', message.block);
|
||||||
this._broadcast(this.subscriptions.block, 'p2p/block', block);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
P2P.prototype._onPeerDisconnect = function(peer, addr) {
|
P2P.prototype._onPeerDisconnect = function(peer, addr) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user