Skip to content

Commit

Permalink
multi: remove MsgAlert
Browse files Browse the repository at this point in the history
It is currently unused and does not fit into decentralization.
  • Loading branch information
dajohi committed Mar 29, 2018
1 parent b092705 commit 8c0d288
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 872 deletions.
5 changes: 1 addition & 4 deletions peer/log.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2015-2016 The btcsuite developers
// Copyright (c) 2016 The Decred developers
// Copyright (c) 2016-2018 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -162,9 +162,6 @@ func messageSummary(msg wire.Message) string {
case *wire.MsgPong:
// No summary - perhaps add nonce.

case *wire.MsgAlert:
// No summary.

case *wire.MsgMemPool:
// No summary.

Expand Down
10 changes: 1 addition & 9 deletions peer/peer.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2016-2017 The Decred developers
// Copyright (c) 2016-2018 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -108,9 +108,6 @@ type MessageListeners struct {
// OnPong is invoked when a peer receives a pong wire message.
OnPong func(p *Peer, msg *wire.MsgPong)

// OnAlert is invoked when a peer receives an alert wire message.
OnAlert func(p *Peer, msg *wire.MsgAlert)

// OnMemPool is invoked when a peer receives a mempool wire message.
OnMemPool func(p *Peer, msg *wire.MsgMemPool)

Expand Down Expand Up @@ -1460,11 +1457,6 @@ out:
p.cfg.Listeners.OnPong(p, msg)
}

case *wire.MsgAlert:
if p.cfg.Listeners.OnAlert != nil {
p.cfg.Listeners.OnAlert(p, msg)
}

case *wire.MsgMemPool:
if p.cfg.Listeners.OnMemPool != nil {
p.cfg.Listeners.OnMemPool(p, msg)
Expand Down
9 changes: 1 addition & 8 deletions peer/peer_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2015-2016 The btcsuite developers
// Copyright (c) 2016-2017 The Decred developers
// Copyright (c) 2016-2018 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -338,9 +338,6 @@ func TestPeerListeners(t *testing.T) {
OnPong: func(p *peer.Peer, msg *wire.MsgPong) {
ok <- msg
},
OnAlert: func(p *peer.Peer, msg *wire.MsgAlert) {
ok <- msg
},
OnMemPool: func(p *peer.Peer, msg *wire.MsgMemPool) {
ok <- msg
},
Expand Down Expand Up @@ -449,10 +446,6 @@ func TestPeerListeners(t *testing.T) {
"OnPong",
wire.NewMsgPong(42),
},
{
"OnAlert",
wire.NewMsgAlert([]byte("payload"), []byte("signature")),
},
{
"OnMemPool",
wire.NewMsgMemPool(),
Expand Down
6 changes: 1 addition & 5 deletions wire/message.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2017 The Decred developers
// Copyright (c) 2015-2018 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -43,7 +43,6 @@ const (
CmdHeaders = "headers"
CmdPing = "ping"
CmdPong = "pong"
CmdAlert = "alert"
CmdMemPool = "mempool"
CmdMiningState = "miningstate"
CmdGetMiningState = "getminings"
Expand Down Expand Up @@ -114,9 +113,6 @@ func makeEmptyMessage(command string) (Message, error) {
case CmdHeaders:
msg = &MsgHeaders{}

case CmdAlert:
msg = &MsgAlert{}

case CmdMemPool:
msg = &MsgMemPool{}

Expand Down
4 changes: 1 addition & 3 deletions wire/message_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Copyright (c) 2015-2018 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -68,7 +68,6 @@ func TestMessage(t *testing.T) {
msgPong := NewMsgPong(123123)
msgGetHeaders := NewMsgGetHeaders()
msgHeaders := NewMsgHeaders()
msgAlert := NewMsgAlert([]byte("payload"), []byte("signature"))
msgMemPool := NewMsgMemPool()
msgFilterAdd := NewMsgFilterAdd([]byte{0x01})
msgFilterClear := NewMsgFilterClear()
Expand Down Expand Up @@ -116,7 +115,6 @@ func TestMessage(t *testing.T) {
{msgPong, msgPong, pver, MainNet, 32}, // [11]
{msgGetHeaders, msgGetHeaders, pver, MainNet, 61}, // [12]
{msgHeaders, msgHeaders, pver, MainNet, 25}, // [13]
{msgAlert, msgAlert, pver, MainNet, 42}, // [14]
{msgMemPool, msgMemPool, pver, MainNet, 24}, // [15]
{msgFilterAdd, msgFilterAdd, pver, MainNet, 26}, // [16]
{msgFilterClear, msgFilterClear, pver, MainNet, 24}, // [17]
Expand Down
Loading

0 comments on commit 8c0d288

Please sign in to comment.