@@ -179,7 +179,7 @@ func (t *BlockTest) insertBlocks(blockchain *core.BlockChain) ([]btBlock, error)
179
179
if b .BlockHeader == nil {
180
180
continue // OK - block is supposed to be invalid, continue with next block
181
181
} else {
182
- return nil , fmt .Errorf ("Block RLP decoding failed when expected to succeed: %v" , err )
182
+ return nil , fmt .Errorf ("block RLP decoding failed when expected to succeed: %v" , err )
183
183
}
184
184
}
185
185
// RLP decoding worked, try to insert into chain:
@@ -189,16 +189,16 @@ func (t *BlockTest) insertBlocks(blockchain *core.BlockChain) ([]btBlock, error)
189
189
if b .BlockHeader == nil {
190
190
continue // OK - block is supposed to be invalid, continue with next block
191
191
} else {
192
- return nil , fmt .Errorf ("Block #%v insertion into chain failed: %v" , blocks [i ].Number (), err )
192
+ return nil , fmt .Errorf ("block #%v insertion into chain failed: %v" , blocks [i ].Number (), err )
193
193
}
194
194
}
195
195
if b .BlockHeader == nil {
196
- return nil , fmt .Errorf ("Block insertion should have failed" )
196
+ return nil , fmt .Errorf ("block insertion should have failed" )
197
197
}
198
198
199
199
// validate RLP decoding by checking all values against test file JSON
200
200
if err = validateHeader (b .BlockHeader , cb .Header ()); err != nil {
201
- return nil , fmt .Errorf ("Deserialised block header validation failed: %v" , err )
201
+ return nil , fmt .Errorf ("deserialised block header validation failed: %v" , err )
202
202
}
203
203
validBlocks = append (validBlocks , b )
204
204
}
@@ -207,49 +207,49 @@ func (t *BlockTest) insertBlocks(blockchain *core.BlockChain) ([]btBlock, error)
207
207
208
208
func validateHeader (h * btHeader , h2 * types.Header ) error {
209
209
if h .Bloom != h2 .Bloom {
210
- return fmt .Errorf ("Bloom : want: %x have: %x" , h .Bloom , h2 .Bloom )
210
+ return fmt .Errorf ("bloom : want: %x have: %x" , h .Bloom , h2 .Bloom )
211
211
}
212
212
if h .Coinbase != h2 .Coinbase {
213
- return fmt .Errorf ("Coinbase : want: %x have: %x" , h .Coinbase , h2 .Coinbase )
213
+ return fmt .Errorf ("coinbase : want: %x have: %x" , h .Coinbase , h2 .Coinbase )
214
214
}
215
215
if h .MixHash != h2 .MixDigest {
216
216
return fmt .Errorf ("MixHash: want: %x have: %x" , h .MixHash , h2 .MixDigest )
217
217
}
218
218
if h .Nonce != h2 .Nonce {
219
- return fmt .Errorf ("Nonce : want: %x have: %x" , h .Nonce , h2 .Nonce )
219
+ return fmt .Errorf ("nonce : want: %x have: %x" , h .Nonce , h2 .Nonce )
220
220
}
221
221
if h .Number .Cmp (h2 .Number ) != 0 {
222
- return fmt .Errorf ("Number : want: %v have: %v" , h .Number , h2 .Number )
222
+ return fmt .Errorf ("number : want: %v have: %v" , h .Number , h2 .Number )
223
223
}
224
224
if h .ParentHash != h2 .ParentHash {
225
- return fmt .Errorf ("Parent hash: want: %x have: %x" , h .ParentHash , h2 .ParentHash )
225
+ return fmt .Errorf ("parent hash: want: %x have: %x" , h .ParentHash , h2 .ParentHash )
226
226
}
227
227
if h .ReceiptTrie != h2 .ReceiptHash {
228
- return fmt .Errorf ("Receipt hash: want: %x have: %x" , h .ReceiptTrie , h2 .ReceiptHash )
228
+ return fmt .Errorf ("receipt hash: want: %x have: %x" , h .ReceiptTrie , h2 .ReceiptHash )
229
229
}
230
230
if h .TransactionsTrie != h2 .TxHash {
231
- return fmt .Errorf ("Tx hash: want: %x have: %x" , h .TransactionsTrie , h2 .TxHash )
231
+ return fmt .Errorf ("tx hash: want: %x have: %x" , h .TransactionsTrie , h2 .TxHash )
232
232
}
233
233
if h .StateRoot != h2 .Root {
234
- return fmt .Errorf ("State hash: want: %x have: %x" , h .StateRoot , h2 .Root )
234
+ return fmt .Errorf ("state hash: want: %x have: %x" , h .StateRoot , h2 .Root )
235
235
}
236
236
if h .UncleHash != h2 .UncleHash {
237
- return fmt .Errorf ("Uncle hash: want: %x have: %x" , h .UncleHash , h2 .UncleHash )
237
+ return fmt .Errorf ("uncle hash: want: %x have: %x" , h .UncleHash , h2 .UncleHash )
238
238
}
239
239
if ! bytes .Equal (h .ExtraData , h2 .Extra ) {
240
- return fmt .Errorf ("Extra data: want: %x have: %x" , h .ExtraData , h2 .Extra )
240
+ return fmt .Errorf ("extra data: want: %x have: %x" , h .ExtraData , h2 .Extra )
241
241
}
242
242
if h .Difficulty .Cmp (h2 .Difficulty ) != 0 {
243
- return fmt .Errorf ("Difficulty : want: %v have: %v" , h .Difficulty , h2 .Difficulty )
243
+ return fmt .Errorf ("difficulty : want: %v have: %v" , h .Difficulty , h2 .Difficulty )
244
244
}
245
245
if h .GasLimit != h2 .GasLimit {
246
- return fmt .Errorf ("GasLimit : want: %d have: %d" , h .GasLimit , h2 .GasLimit )
246
+ return fmt .Errorf ("gasLimit : want: %d have: %d" , h .GasLimit , h2 .GasLimit )
247
247
}
248
248
if h .GasUsed != h2 .GasUsed {
249
- return fmt .Errorf ("GasUsed : want: %d have: %d" , h .GasUsed , h2 .GasUsed )
249
+ return fmt .Errorf ("gasUsed : want: %d have: %d" , h .GasUsed , h2 .GasUsed )
250
250
}
251
251
if h .Timestamp != h2 .Time {
252
- return fmt .Errorf ("Timestamp : want: %v have: %v" , h .Timestamp , h2 .Time )
252
+ return fmt .Errorf ("timestamp : want: %v have: %v" , h .Timestamp , h2 .Time )
253
253
}
254
254
return nil
255
255
}
@@ -287,7 +287,7 @@ func (t *BlockTest) validateImportedHeaders(cm *core.BlockChain, validBlocks []b
287
287
// be part of the longest chain until last block is imported.
288
288
for b := cm .CurrentBlock (); b != nil && b .NumberU64 () != 0 ; b = cm .GetBlockByHash (b .Header ().ParentHash ) {
289
289
if err := validateHeader (bmap [b .Hash ()].BlockHeader , b .Header ()); err != nil {
290
- return fmt .Errorf ("Imported block header validation failed: %v" , err )
290
+ return fmt .Errorf ("imported block header validation failed: %v" , err )
291
291
}
292
292
}
293
293
return nil
0 commit comments