1
1
// Copyright 2020 The go-ethereum Authors
2
- // This file is part of the go-ethereum library .
2
+ // This file is part of go-ethereum.
3
3
//
4
- // The go-ethereum library is free software: you can redistribute it and/or modify
5
- // it under the terms of the GNU Lesser General Public License as published by
4
+ // go-ethereum is free software: you can redistribute it and/or modify
5
+ // it under the terms of the GNU General Public License as published by
6
6
// the Free Software Foundation, either version 3 of the License, or
7
7
// (at your option) any later version.
8
8
//
9
- // The go-ethereum library is distributed in the hope that it will be useful,
9
+ // go-ethereum is distributed in the hope that it will be useful,
10
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- // GNU Lesser General Public License for more details.
12
+ // GNU General Public License for more details.
13
13
//
14
- // You should have received a copy of the GNU Lesser General Public License
15
- // along with the go-ethereum library . If not, see <http://www.gnu.org/licenses/>.
14
+ // You should have received a copy of the GNU General Public License
15
+ // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
16
16
17
17
package ethtest
18
18
@@ -141,18 +141,18 @@ func TestChain_GetHeaders(t *testing.T) {
141
141
142
142
var tests = []struct {
143
143
req GetBlockHeaders
144
- expected BlockHeaders
144
+ expected [] * types. Header
145
145
}{
146
146
{
147
147
req : GetBlockHeaders {
148
- Origin : eth.HashOrNumber {
149
- Number : uint64 (2 ),
148
+ GetBlockHeadersPacket : & eth.GetBlockHeadersPacket {
149
+ Origin : eth.HashOrNumber {Number : uint64 (2 )},
150
+ Amount : uint64 (5 ),
151
+ Skip : 1 ,
152
+ Reverse : false ,
150
153
},
151
- Amount : uint64 (5 ),
152
- Skip : 1 ,
153
- Reverse : false ,
154
154
},
155
- expected : BlockHeaders {
155
+ expected : [] * types. Header {
156
156
chain .blocks [2 ].Header (),
157
157
chain .blocks [4 ].Header (),
158
158
chain .blocks [6 ].Header (),
@@ -162,37 +162,37 @@ func TestChain_GetHeaders(t *testing.T) {
162
162
},
163
163
{
164
164
req : GetBlockHeaders {
165
- Origin : eth.HashOrNumber {
166
- Number : uint64 (chain .Len () - 1 ),
165
+ GetBlockHeadersPacket : & eth.GetBlockHeadersPacket {
166
+ Origin : eth.HashOrNumber {Number : uint64 (chain .Len () - 1 )},
167
+ Amount : uint64 (3 ),
168
+ Skip : 0 ,
169
+ Reverse : true ,
167
170
},
168
- Amount : uint64 (3 ),
169
- Skip : 0 ,
170
- Reverse : true ,
171
171
},
172
- expected : BlockHeaders {
172
+ expected : [] * types. Header {
173
173
chain .blocks [chain .Len ()- 1 ].Header (),
174
174
chain .blocks [chain .Len ()- 2 ].Header (),
175
175
chain .blocks [chain .Len ()- 3 ].Header (),
176
176
},
177
177
},
178
178
{
179
179
req : GetBlockHeaders {
180
- Origin : eth.HashOrNumber {
181
- Hash : chain .Head ().Hash (),
180
+ GetBlockHeadersPacket : & eth.GetBlockHeadersPacket {
181
+ Origin : eth.HashOrNumber {Hash : chain .Head ().Hash ()},
182
+ Amount : uint64 (1 ),
183
+ Skip : 0 ,
184
+ Reverse : false ,
182
185
},
183
- Amount : uint64 (1 ),
184
- Skip : 0 ,
185
- Reverse : false ,
186
186
},
187
- expected : BlockHeaders {
187
+ expected : [] * types. Header {
188
188
chain .Head ().Header (),
189
189
},
190
190
},
191
191
}
192
192
193
193
for i , tt := range tests {
194
194
t .Run (strconv .Itoa (i ), func (t * testing.T ) {
195
- headers , err := chain .GetHeaders (tt .req )
195
+ headers , err := chain .GetHeaders (& tt .req )
196
196
if err != nil {
197
197
t .Fatal (err )
198
198
}
0 commit comments