Skip to content

NullReferenceException in ExtractDepositsFromBlock #300

@MithrilMan

Description

@MithrilMan

While watching logs of #288 I see we have this exceptions from time to time:

2018-12-15 18:15:06.0672||28||TRACE||Stratis.FederatedPeg.Features.FederationGateway.SourceChain.DepositExtractor.ExtractDepositsFromBlock||(block:<NULL>,blockHeight:203)||||<GetMaturedDepositsAsync>d__6.MoveNext => DepositExtractor.ExtractBlockDeposits => DepositExtractor.ExtractDepositsFromBlock

2018-12-15 18:15:06.0672||28||TRACE||Stratis.FederatedPeg.Features.FederationGateway.SourceChain.DepositExtractor.ExtractDepositsFromBlock||(-)$exception:System.NullReferenceException: Object reference not set to an instance of an object.->   at Stratis.FederatedPeg.Features.FederationGateway.SourceChain.DepositExtractor.ExtractDepositsFromBlock(Block block, Int32 blockHeight)||||<GetMaturedDepositsAsync>d__6.MoveNext => DepositExtractor.ExtractBlockDeposits => DepositExtractor.ExtractDepositsFromBlock

we are passing null to ExtractDepositsFromBlock

the only part of code that call this method is :

IReadOnlyList<IDeposit> deposits =
this.ExtractDepositsFromBlock(newlyMaturedBlock.Block, newlyMaturedBlock.ChainedHeader.Height);

of course guarding for null on newlyMaturedBlock.Block will fix this error but I don't know if this is just a symptom of a more serious thing: is it fine to have a newlyMaturedBlock.Block that's null?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions