Skip to content

Commit

Permalink
fix: null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-b-pegasys committed Aug 31, 2021
1 parent ae50ace commit 12a2e39
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2817,7 +2817,12 @@ func (bc *BlockChain) GetTransactionLookup(hash common.Hash) *rawdb.LegacyTxLook
func (bc *BlockChain) Config() *params.ChainConfig { return bc.chainConfig }

// QuorumConfig retrieves the Quorum chain's configuration
func (bc *BlockChain) QuorumConfig() *QuorumChainConfig { return bc.quorumConfig }
func (bc *BlockChain) QuorumConfig() *QuorumChainConfig {
if bc == nil || bc.quorumConfig == nil {
return &QuorumChainConfig{}
}
return bc.quorumConfig
}

// Engine retrieves the blockchain's consensus engine.
func (bc *BlockChain) Engine() consensus.Engine { return bc.engine }
Expand Down
4 changes: 2 additions & 2 deletions core/vm/runtime/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ func (d *dummyChain) SupportsMultitenancy(context.Context) (*proto.PreAuthentica
}

// Config retrieves the chain's fork configuration
func (d *dummyChain) Config() *params.ChainConfig { return nil }
func (d *dummyChain) Config() *params.ChainConfig { return &params.ChainConfig{} }

// QuorumConfig retrieves the Quorum chain's configuration
func (d *dummyChain) QuorumConfig() *core.QuorumChainConfig { return nil }
func (d *dummyChain) QuorumConfig() *core.QuorumChainConfig { return &core.QuorumChainConfig{} }

// PrivateStateManager returns the private state manager
func (d *dummyChain) PrivateStateManager() mps.PrivateStateManager { return nil }
Expand Down
2 changes: 1 addition & 1 deletion light/lightchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ func (lc *LightChain) SupportsMultitenancy(context.Context) (*proto.PreAuthentic
}

// QuorumConfig retrieves the Quorum chain's configuration
func (lc *LightChain) QuorumConfig() *core.QuorumChainConfig { return nil }
func (lc *LightChain) QuorumConfig() *core.QuorumChainConfig { return &core.QuorumChainConfig{} }

// PrivateStateManager returns the private state manager
func (lc *LightChain) PrivateStateManager() mps.PrivateStateManager { return nil }
Expand Down

0 comments on commit 12a2e39

Please sign in to comment.