node: arbitrum watcher fix (#1812)
* node: arbitrum watcher fix * Add comment * Update the comment
This commit is contained in:
parent
af633ce300
commit
914aa99a60
|
@ -173,7 +173,10 @@ func (b *BlockPollConnector) getBlock(ctx context.Context, logger *zap.Logger, n
|
||||||
type Marshaller struct {
|
type Marshaller struct {
|
||||||
Number *ethHexUtils.Big
|
Number *ethHexUtils.Big
|
||||||
Hash ethCommon.Hash `json:"hash"`
|
Hash ethCommon.Hash `json:"hash"`
|
||||||
Difficulty *ethHexUtils.Big
|
|
||||||
|
// L1BlockNumber is the L1 block number in which an Arbitrum batch containing this block was submitted.
|
||||||
|
// This field is only populated when connecting to Arbitrum.
|
||||||
|
L1BlockNumber *ethHexUtils.Big
|
||||||
}
|
}
|
||||||
|
|
||||||
var m Marshaller
|
var m Marshaller
|
||||||
|
@ -190,8 +193,16 @@ func (b *BlockPollConnector) getBlock(ctx context.Context, logger *zap.Logger, n
|
||||||
return nil, fmt.Errorf("failed to unmarshal block: Number is nil")
|
return nil, fmt.Errorf("failed to unmarshal block: Number is nil")
|
||||||
}
|
}
|
||||||
n := big.Int(*m.Number)
|
n := big.Int(*m.Number)
|
||||||
|
|
||||||
|
var l1bn *big.Int
|
||||||
|
if m.L1BlockNumber != nil {
|
||||||
|
bn := big.Int(*m.L1BlockNumber)
|
||||||
|
l1bn = &bn
|
||||||
|
}
|
||||||
|
|
||||||
return &NewBlock{
|
return &NewBlock{
|
||||||
Number: &n,
|
Number: &n,
|
||||||
Hash: m.Hash,
|
Hash: m.Hash,
|
||||||
|
L1BlockNumber: l1bn,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue