Skip to content

Commit 9988f03

Browse files
committed
Drop more dead code.
1 parent 3e94d8a commit 9988f03

File tree

5 files changed

+23
-63
lines changed

5 files changed

+23
-63
lines changed

node/config.go

-12
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,6 @@ func (c *Config) HTTPEndpoint() string {
177177
return fmt.Sprintf("%s:%d", c.HTTPHost, c.HTTPPort)
178178
}
179179

180-
// DefaultHTTPEndpoint returns the HTTP endpoint used by default.
181-
func DefaultHTTPEndpoint() string {
182-
config := &Config{HTTPHost: common.DefaultHTTPHost, HTTPPort: common.DefaultHTTPPort}
183-
return config.HTTPEndpoint()
184-
}
185-
186180
// WSEndpoint resolves an websocket endpoint based on the configured host interface
187181
// and port parameters.
188182
func (c *Config) WSEndpoint() string {
@@ -192,12 +186,6 @@ func (c *Config) WSEndpoint() string {
192186
return fmt.Sprintf("%s:%d", c.WSHost, c.WSPort)
193187
}
194188

195-
// DefaultWSEndpoint returns the websocket endpoint used by default.
196-
func DefaultWSEndpoint() string {
197-
config := &Config{WSHost: common.DefaultWSHost, WSPort: common.DefaultWSPort}
198-
return config.WSEndpoint()
199-
}
200-
201189
// NodeKey retrieves the currently configured private key of the node, checking
202190
// first any manually set key, falling back to the one found in the configured
203191
// data folder. If no key can be found, a new one is generated.

rlp/decode.go

-10
Original file line numberDiff line numberDiff line change
@@ -635,16 +635,6 @@ func NewStream(r io.Reader, inputLimit uint64) *Stream {
635635
return s
636636
}
637637

638-
// NewListStream creates a new stream that pretends to be positioned
639-
// at an encoded list of the given length.
640-
func NewListStream(r io.Reader, len uint64) *Stream {
641-
s := new(Stream)
642-
s.Reset(r, len)
643-
s.kind = List
644-
s.size = len
645-
return s
646-
}
647-
648638
// Bytes reads an RLP string and returns its contents as a byte slice.
649639
// If the input does not contain an RLP string, the returned
650640
// error will be ErrExpectedString.

rlp/decode_test.go

-18
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,6 @@ func TestStreamKind(t *testing.T) {
6565
}
6666
}
6767

68-
func TestNewListStream(t *testing.T) {
69-
ls := NewListStream(bytes.NewReader(unhex("0101010101")), 3)
70-
if k, size, err := ls.Kind(); k != List || size != 3 || err != nil {
71-
t.Errorf("Kind() returned (%v, %d, %v), expected (List, 3, nil)", k, size, err)
72-
}
73-
if size, err := ls.List(); size != 3 || err != nil {
74-
t.Errorf("List() returned (%d, %v), expected (3, nil)", size, err)
75-
}
76-
for i := 0; i < 3; i++ {
77-
if val, err := ls.Uint(); val != 1 || err != nil {
78-
t.Errorf("Uint() returned (%d, %v), expected (1, nil)", val, err)
79-
}
80-
}
81-
if err := ls.ListEnd(); err != nil {
82-
t.Errorf("ListEnd() returned %v, expected (3, nil)", err)
83-
}
84-
}
85-
8668
func TestStreamErrors(t *testing.T) {
8769
withoutInputLimit := func(b []byte) *Stream {
8870
return NewStream(newPlainReader(b), 0)

trie/proof.go

-23
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,3 @@ func (t *Trie) Prove(key []byte) []rlp.RawValue {
8383
}
8484
return proof
8585
}
86-
87-
func get(tn node, key []byte) ([]byte, node) {
88-
for len(key) > 0 {
89-
switch n := tn.(type) {
90-
case *shortNode:
91-
if len(key) < len(n.Key) || !bytes.Equal(n.Key, key[:len(n.Key)]) {
92-
return nil, nil
93-
}
94-
tn = n.Val
95-
key = key[len(n.Key):]
96-
case *fullNode:
97-
tn = n.Children[key[0]]
98-
key = key[1:]
99-
case hashNode:
100-
return key, n
101-
case nil:
102-
return key, nil
103-
default:
104-
panic(fmt.Sprintf("%T: invalid node: %v", tn, tn))
105-
}
106-
}
107-
return nil, tn.(valueNode)
108-
}

trie/proof_test.go

+23
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,26 @@ func verifyProof(rootHash common.Hash, key []byte, proof []rlp.RawValue) (value
177177
}
178178
return nil, errors.New("unexpected end of proof")
179179
}
180+
181+
func get(tn node, key []byte) ([]byte, node) {
182+
for len(key) > 0 {
183+
switch n := tn.(type) {
184+
case *shortNode:
185+
if len(key) < len(n.Key) || !bytes.Equal(n.Key, key[:len(n.Key)]) {
186+
return nil, nil
187+
}
188+
tn = n.Val
189+
key = key[len(n.Key):]
190+
case *fullNode:
191+
tn = n.Children[key[0]]
192+
key = key[1:]
193+
case hashNode:
194+
return key, n
195+
case nil:
196+
return key, nil
197+
default:
198+
panic(fmt.Sprintf("%T: invalid node: %v", tn, tn))
199+
}
200+
}
201+
return nil, tn.(valueNode)
202+
}

0 commit comments

Comments
 (0)