mirror of https://github.com/BTCPrivate/copay.git
fix test 10
This commit is contained in:
parent
609d0327cc
commit
c4515d644d
|
@ -218,10 +218,7 @@ Network.prototype._onMessage = function(enc) {
|
|||
}
|
||||
//ensure claimed public key is actually the public key of the peer
|
||||
//e.g., their public key should hash to be their peerId
|
||||
if (enc.pubkey !== payload.copayerId) {
|
||||
console.log(JSON.stringify(enc));
|
||||
console.log(JSON.stringify(enc.pubkey));
|
||||
console.log(JSON.stringify(payload.copayerId));
|
||||
if (sender !== payload.copayerId) {
|
||||
this._deletePeer(enc.pubkey, 'incorrect pubkey for peerId');
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -122,18 +122,17 @@ describe('Network / Async', function() {
|
|||
var cid3 = '034d3dd2054234737c1cff9d973c9c7e0fb5902c8e56c9d57a699b7842cedfe984';
|
||||
|
||||
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 = {
|
||||
type: 'hello',
|
||||
copayerId: cid1
|
||||
};
|
||||
var enc = n.encode(cid2, message);
|
||||
|
||||
n._deletePeer = sinon.spy();
|
||||
|
||||
n._onMessage(enc);
|
||||
n._deletePeer.calledOnce.should.equal(false);
|
||||
var enc = n1.encode(cid2, message);
|
||||
n2._onMessage(enc);
|
||||
n2._deletePeer.calledOnce.should.equal(false);
|
||||
});
|
||||
|
||||
it('should reject data sent from a peer with hijacked pubkey', function() {
|
||||
|
|
Loading…
Reference in New Issue