From d23dc4e739222c29eb891c786a82ec5d81c5724f Mon Sep 17 00:00:00 2001 From: Joseph deBlaquiere Date: Fri, 9 Nov 2018 20:55:46 +0000 Subject: [PATCH 1/3] OnVersion now supports returning a Reject Message to peer (which will be disconnected after Reject message is sent) --- neutrino.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/neutrino.go b/neutrino.go index 4e24af98b..8e17b9052 100644 --- a/neutrino.go +++ b/neutrino.go @@ -248,7 +248,7 @@ func (sp *ServerPeer) OnVerAck(_ *peer.Peer, msg *wire.MsgVerAck) { // OnVersion is invoked when a peer receives a version bitcoin message // and is used to negotiate the protocol version details as well as kick start // the communications. -func (sp *ServerPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) { +func (sp *ServerPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) *wire.MsgReject { // Add the remote peer time as a sample for creating an offset against // the local clock to keep the network time in sync. sp.server.timeSource.AddTimeSample(sp.Addr(), msg.Timestamp) @@ -262,8 +262,10 @@ func (sp *ServerPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) { log.Infof("Disconnecting peer %v, cannot serve compact "+ "filters", sp) - sp.Disconnect() - return + reason := fmt.Sprintf("Support for compact filters is required") + rejectMsg := wire.NewMsgReject(msg.Command(), wire.RejectObsolete, + reason) + return rejectMsg } // Signal the block manager this peer is a new sync candidate. @@ -291,6 +293,7 @@ func (sp *ServerPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) { // Add valid peer to the server. sp.server.AddPeer(sp) + return nil } // OnInv is invoked when a peer receives an inv bitcoin message and is From e11a473eca8c54ad45c48f5d2c65f4b7391ff50f Mon Sep 17 00:00:00 2001 From: Joseph deBlaquiere Date: Fri, 9 Nov 2018 21:25:06 +0000 Subject: [PATCH 2/3] glide vendor versioning --- glide.lock | 10 +++++----- glide.yaml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/glide.lock b/glide.lock index 1bfce3e9d..ea9c520c8 100644 --- a/glide.lock +++ b/glide.lock @@ -1,10 +1,10 @@ -hash: d643fb2b4e206b1cf65711308cb3719f2a6a6e259065d18de92722ef3d2bbba2 -updated: 2018-09-03T18:17:04.668851582-07:00 +hash: 5f799ea7ce4fbb4787e01018f569d3b63e042e6cee1e442a8c7c9f10b3a4c864 +updated: 2018-11-09T21:24:14.090074737Z imports: - name: github.com/aead/siphash version: 83563a290f60225eb120d724600b9690c3fb536f - name: github.com/btcsuite/btcd - version: 79e00513b1011888b1e675157ab89f527f901cae + version: 67e573d211ace594f1366b4ce9d39726c4b19bd0 subpackages: - addrmgr - blockchain @@ -78,11 +78,11 @@ imports: subpackages: - ripemd160 - name: golang.org/x/net - version: 8a410e7b638dca158bf9e766925842f6651ff828 + version: 922f4815f713f213882e8ef45e0d315b164d705c subpackages: - context - name: golang.org/x/sys - version: 2b024373dcd9800f0cae693839fac6ede8d64a8c + version: 3b58ed4ad3395d483fc92d5d14123ce2c3581fec subpackages: - unix - name: google.golang.org/grpc diff --git a/glide.yaml b/glide.yaml index dc1589287..45d2f2dfd 100644 --- a/glide.yaml +++ b/glide.yaml @@ -3,7 +3,7 @@ import: - package: github.com/coreos/bbolt version: 4f5275f4ebbf6fe7cb772de987fa96ee674460a7 - package: github.com/btcsuite/btcd - version: 79e00513b1011888b1e675157ab89f527f901cae + version: 67e573d211ace594f1366b4ce9d39726c4b19bd0 subpackages: - blockchain - btcec From 8a24ecb73baf123b6ec1eb1ce9ae29d43ba3e3b7 Mon Sep 17 00:00:00 2001 From: jadeblaquiere Date: Thu, 6 Dec 2018 17:39:07 -0500 Subject: [PATCH 3/3] message format change --- neutrino.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/neutrino.go b/neutrino.go index 8e17b9052..5c4573fd6 100644 --- a/neutrino.go +++ b/neutrino.go @@ -260,8 +260,7 @@ func (sp *ServerPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) *wire.MsgRej if peerServices&wire.SFNodeWitness != wire.SFNodeWitness || peerServices&wire.SFNodeCF != wire.SFNodeCF { - log.Infof("Disconnecting peer %v, cannot serve compact "+ - "filters", sp) + log.Infof("Disconnecting peer %v, cannot serve compact filters", sp) reason := fmt.Sprintf("Support for compact filters is required") rejectMsg := wire.NewMsgReject(msg.Command(), wire.RejectObsolete, reason)