fix test 10
This commit is contained in:
parent
609d0327cc
commit
c4515d644d
2 changed files with 7 additions and 11 deletions
|
|
@ -218,10 +218,7 @@ Network.prototype._onMessage = function(enc) {
|
||||||
}
|
}
|
||||||
//ensure claimed public key is actually the public key of the peer
|
//ensure claimed public key is actually the public key of the peer
|
||||||
//e.g., their public key should hash to be their peerId
|
//e.g., their public key should hash to be their peerId
|
||||||
if (enc.pubkey !== payload.copayerId) {
|
if (sender !== payload.copayerId) {
|
||||||
console.log(JSON.stringify(enc));
|
|
||||||
console.log(JSON.stringify(enc.pubkey));
|
|
||||||
console.log(JSON.stringify(payload.copayerId));
|
|
||||||
this._deletePeer(enc.pubkey, 'incorrect pubkey for peerId');
|
this._deletePeer(enc.pubkey, 'incorrect pubkey for peerId');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,18 +122,17 @@ describe('Network / Async', function() {
|
||||||
var cid3 = '034d3dd2054234737c1cff9d973c9c7e0fb5902c8e56c9d57a699b7842cedfe984';
|
var cid3 = '034d3dd2054234737c1cff9d973c9c7e0fb5902c8e56c9d57a699b7842cedfe984';
|
||||||
|
|
||||||
it('should not reject data sent from a peer with hijacked pubkey', function() {
|
it('should not reject data sent from a peer with hijacked pubkey', function() {
|
||||||
var n = createN(pk2);
|
var n1 = createN(pk1);
|
||||||
|
var n2 = createN(pk2);
|
||||||
|
n2._deletePeer = sinon.spy();
|
||||||
|
|
||||||
var message = {
|
var message = {
|
||||||
type: 'hello',
|
type: 'hello',
|
||||||
copayerId: cid1
|
copayerId: cid1
|
||||||
};
|
};
|
||||||
var enc = n.encode(cid2, message);
|
var enc = n1.encode(cid2, message);
|
||||||
|
n2._onMessage(enc);
|
||||||
n._deletePeer = sinon.spy();
|
n2._deletePeer.calledOnce.should.equal(false);
|
||||||
|
|
||||||
n._onMessage(enc);
|
|
||||||
n._deletePeer.calledOnce.should.equal(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reject data sent from a peer with hijacked pubkey', function() {
|
it('should reject data sent from a peer with hijacked pubkey', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue