@@ -8,7 +8,6 @@ package builder
8
8
import (
9
9
"context"
10
10
"fmt"
11
- "time"
12
11
13
12
"go.uber.org/zap"
14
13
@@ -20,11 +19,9 @@ import (
20
19
"github.com/ava-labs/avalanchego/vms/platformvm/txs"
21
20
)
22
21
23
- const (
24
- // We allow [recentCacheSize] to be fairly large because we only store hashes
25
- // in the cache, not entire transactions.
26
- recentCacheSize = 512
27
- )
22
+ // We allow [recentCacheSize] to be fairly large because we only store hashes
23
+ // in the cache, not entire transactions.
24
+ const recentCacheSize = 512
28
25
29
26
var _ Network = (* network )(nil )
30
27
@@ -36,6 +33,9 @@ type Network interface {
36
33
}
37
34
38
35
type network struct {
36
+ // We embed a noop handler for all unhandled messages
37
+ common.AppHandler
38
+
39
39
ctx * snow.Context
40
40
blkBuilder * builder
41
41
@@ -50,49 +50,15 @@ func NewNetwork(
50
50
appSender common.AppSender ,
51
51
) Network {
52
52
return & network {
53
+ AppHandler : common .NewNoOpAppHandler (ctx .Log ),
54
+
53
55
ctx : ctx ,
54
56
blkBuilder : blkBuilder ,
55
57
appSender : appSender ,
56
58
recentTxs : & cache.LRU [ids.ID , struct {}]{Size : recentCacheSize },
57
59
}
58
60
}
59
61
60
- func (* network ) CrossChainAppRequestFailed (context.Context , ids.ID , uint32 ) error {
61
- // This VM currently only supports gossiping of txs, so there are no
62
- // requests.
63
- return nil
64
- }
65
-
66
- func (* network ) CrossChainAppRequest (context.Context , ids.ID , uint32 , time.Time , []byte ) error {
67
- // This VM currently only supports gossiping of txs, so there are no
68
- // requests.
69
- return nil
70
- }
71
-
72
- func (* network ) CrossChainAppResponse (context.Context , ids.ID , uint32 , []byte ) error {
73
- // This VM currently only supports gossiping of txs, so there are no
74
- // requests.
75
- return nil
76
- }
77
-
78
- func (* network ) AppRequestFailed (context.Context , ids.NodeID , uint32 ) error {
79
- // This VM currently only supports gossiping of txs, so there are no
80
- // requests.
81
- return nil
82
- }
83
-
84
- func (* network ) AppRequest (context.Context , ids.NodeID , uint32 , time.Time , []byte ) error {
85
- // This VM currently only supports gossiping of txs, so there are no
86
- // requests.
87
- return nil
88
- }
89
-
90
- func (* network ) AppResponse (context.Context , ids.NodeID , uint32 , []byte ) error {
91
- // This VM currently only supports gossiping of txs, so there are no
92
- // requests.
93
- return nil
94
- }
95
-
96
62
func (n * network ) AppGossip (_ context.Context , nodeID ids.NodeID , msgBytes []byte ) error {
97
63
n .ctx .Log .Debug ("called AppGossip message handler" ,
98
64
zap .Stringer ("nodeID" , nodeID ),
0 commit comments