test: fix protocol tests.
This commit is contained in:
parent
8f51d36655
commit
5fa102d5bd
@ -80,13 +80,13 @@ describe('Protocol', function() {
|
|||||||
services: constants.LOCAL_SERVICES,
|
services: constants.LOCAL_SERVICES,
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
port: 8333,
|
port: 8333,
|
||||||
ts: Date.now() / 1000 | 0
|
ts: utils.now()
|
||||||
}),
|
}),
|
||||||
new NetworkAddress({
|
new NetworkAddress({
|
||||||
services: constants.LOCAL_SERVICES,
|
services: constants.LOCAL_SERVICES,
|
||||||
host: '::123:456:789a',
|
host: '::123:456:789a',
|
||||||
port: 18333,
|
port: 18333,
|
||||||
ts: Date.now() / 1000 | 0
|
ts: utils.now()
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -199,21 +199,21 @@ describe('Protocol', function() {
|
|||||||
'c9954c44b0ce168bc78efd5f1e1c7db9d6c21b3016599ffffffff01a029' +
|
'c9954c44b0ce168bc78efd5f1e1c7db9d6c21b3016599ffffffff01a029' +
|
||||||
'de5c0500000017a9141d9ca71efa36d814424ea6ca1437e67287aebe348' +
|
'de5c0500000017a9141d9ca71efa36d814424ea6ca1437e67287aebe348' +
|
||||||
'700000000', 'hex');
|
'700000000', 'hex');
|
||||||
var tx = Parser.parseTX(rawTwoTxs);
|
var tx = bcoin.tx.fromRaw(rawTwoTxs);
|
||||||
delete tx._raw;
|
tx._raw = null;
|
||||||
assert.deepEqual(Framer.tx(tx), rawFirstTx);
|
assert.deepEqual(tx.toRaw(), rawFirstTx);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse, reserialize, and verify alert packets', function() {
|
it('should parse, reserialize, and verify alert packets', function() {
|
||||||
var p = new bcoin.reader(alertData);
|
var p = new bcoin.reader(alertData);
|
||||||
p.start();
|
p.start();
|
||||||
while (p.left()) {
|
while (p.left()) {
|
||||||
var alert = Parser.parseAlert(p);
|
var alert = bcoin.packets.AlertPacket.fromRaw(p);
|
||||||
assert(alert.verify(network.alertKey));
|
assert(alert.verify(network.alertKey));
|
||||||
alert._payload = null;
|
alert._payload = null;
|
||||||
alert._hash = null;
|
alert._hash = null;
|
||||||
var data = Framer.alert(alert);
|
var data = alert.toRaw();
|
||||||
alert = Parser.parseAlert(data);
|
alert = bcoin.packets.AlertPacket.fromRaw(data);
|
||||||
assert(alert.verify(network.alertKey));
|
assert(alert.verify(network.alertKey));
|
||||||
}
|
}
|
||||||
p.end();
|
p.end();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user