small changes after code review
This commit is contained in:
parent
c3ead97d64
commit
ed0bcc962a
@ -36,7 +36,7 @@ For advanced usage, you can also customize which constructor is used for Block a
|
||||
var messages = new Messages({Block: MyBlock, Transaction: MyTransaction});
|
||||
```
|
||||
|
||||
And additionally custom network:
|
||||
And additionally a custom network:
|
||||
|
||||
```javascript
|
||||
var messages = new Messages({network: Networks.testnet});
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
var bitcore = require('bitcore');
|
||||
var $ = bitcore.util.preconditions;
|
||||
var Networks = bitcore.Networks;
|
||||
var BufferWriter = bitcore.encoding.BufferWriter;
|
||||
var Hash = bitcore.crypto.Hash;
|
||||
|
||||
@ -16,7 +15,7 @@ var Hash = bitcore.crypto.Hash;
|
||||
*/
|
||||
function Message(options) {
|
||||
this.command = options.command;
|
||||
this.network = options.network || Networks.defaultNetwork;
|
||||
this.network = options.network;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
var should = require('chai').should();
|
||||
var P2P = require('../../');
|
||||
var Message = P2P.Messages.Message;
|
||||
var Networks = require('bitcore').Networks;
|
||||
|
||||
describe('Message', function() {
|
||||
|
||||
@ -23,7 +24,8 @@ describe('Message', function() {
|
||||
describe('#toBuffer', function() {
|
||||
it('serialize to a buffer', function() {
|
||||
var message = new Message({
|
||||
command: 'command'
|
||||
command: 'command',
|
||||
network: Networks.defaultNetwork
|
||||
});
|
||||
message.getPayload = function() {
|
||||
return new Buffer(0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user