Skip to content

Commit f324582

Browse files
bugfixes
1 parent fbce2fb commit f324582

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

eth/tracers/live/firehose.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ func (f *Firehose) OnBlockchainInit(chainConfig *chain.Config) {
304304
f.chainConfig = chainConfig
305305

306306
if wasNeverSent := f.initSent.CompareAndSwap(false, true); wasNeverSent {
307-
f.printToFirehose("INIT", FirehoseProtocolVersion, "geth", params.Version)
307+
f.printToFirehose("INIT", FirehoseProtocolVersion, "erigon", params.Version)
308308
} else {
309309
f.panicInvalidState("The OnBlockchainInit callback was called more than once", 0)
310310
}
@@ -340,7 +340,12 @@ func chainNeedsLegacyBackwardCompatibility(id *big.Int) bool {
340340

341341
func (f *Firehose) OnBlockStart(event tracing.BlockEvent) {
342342
b := event.Block
343-
firehoseInfo("block start (number=%d hash=%s)", b.NumberU64(), b.Hash())
343+
firehoseInfo("block start (number=%d hash=%s td=%v)", b.NumberU64(), b.Hash(), event.TD)
344+
345+
td := event.TD
346+
if td == nil {
347+
td = big.NewInt(0)
348+
}
344349

345350
f.ensureBlockChainInit()
346351

@@ -350,7 +355,7 @@ func (f *Firehose) OnBlockStart(event tracing.BlockEvent) {
350355
f.block = &pbeth.Block{
351356
Hash: b.Hash().Bytes(),
352357
Number: b.Number().Uint64(),
353-
Header: newBlockHeaderFromChainHeader(b.Header(), firehoseBigIntFromNative(new(big.Int).Add(event.TD, b.Difficulty()))),
358+
Header: newBlockHeaderFromChainHeader(b.Header(), firehoseBigIntFromNative(new(big.Int).Add(td, b.Difficulty()))),
354359
Size: uint64(b.Size()),
355360
// Known Firehose issue: If you fix all known Firehose issue for a new chain, don't forget to bump `Ver` to `4`!
356361
Ver: 4,

0 commit comments

Comments
 (0)