node: arbitrum watcher fix (#1812)

* node: arbitrum watcher fix

* Add comment

* Update the comment
This commit is contained in:
bruce-riley 2022-10-28 07:15:01 -05:00 committed by GitHub
parent af633ce300
commit 914aa99a60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 5 deletions

View File

@ -171,9 +171,12 @@ func (b *BlockPollConnector) getBlock(ctx context.Context, logger *zap.Logger, n
}
type Marshaller struct {
Number *ethHexUtils.Big
Hash ethCommon.Hash `json:"hash"`
Difficulty *ethHexUtils.Big
Number *ethHexUtils.Big
Hash ethCommon.Hash `json:"hash"`
// 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
@ -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")
}
n := big.Int(*m.Number)
var l1bn *big.Int
if m.L1BlockNumber != nil {
bn := big.Int(*m.L1BlockNumber)
l1bn = &bn
}
return &NewBlock{
Number: &n,
Hash: m.Hash,
Number: &n,
Hash: m.Hash,
L1BlockNumber: l1bn,
}, nil
}