diff --git a/pkg/state/appender.go b/pkg/state/appender.go index c81d85f9d..71dfca60a 100644 --- a/pkg/state/appender.go +++ b/pkg/state/appender.go @@ -801,7 +801,6 @@ func (a *txAppender) appendBlock(params *appendBlockParams) error { lastSnapshotStateHash: params.lastSnapshotStateHash, fixSnapshotsToInitialHash: params.fixSnapshotsToInitialHash, currentBlockHeight: currentBlockHeight, - readOnly: false, } initialSnapshot, stateHash, err := a.createInitialDiffAndStateHash(createInitHashParams, hasher) if err != nil { @@ -873,7 +872,6 @@ type initialDiffAndStateHashParams struct { lastSnapshotStateHash crypto.Digest fixSnapshotsToInitialHash []proto.AtomicSnapshot currentBlockHeight proto.Height - readOnly bool } // createInitialDiffAndStateHash creates the initial diff and state hash for the block. @@ -1218,7 +1216,6 @@ func (a *txAppender) createNextSnapshotHash( blockHeight proto.Height, lastSnapshotStateHash crypto.Digest, fixSnapshotsToInitialHash []proto.AtomicSnapshot, - readOnly bool, ) (crypto.Digest, error) { hasher, err := newTxSnapshotHasherDefault() if err != nil { @@ -1233,7 +1230,6 @@ func (a *txAppender) createNextSnapshotHash( lastSnapshotStateHash: lastSnapshotStateHash, fixSnapshotsToInitialHash: fixSnapshotsToInitialHash, currentBlockHeight: blockHeight, - readOnly: readOnly, } _, initSh, err := a.createInitialDiffAndStateHash(params, hasher) if err != nil { diff --git a/pkg/state/state.go b/pkg/state/state.go index 768fcb5eb..d25a37e05 100644 --- a/pkg/state/state.go +++ b/pkg/state/state.go @@ -2012,8 +2012,6 @@ func (s *stateManager) ValidateNextTx( } func (s *stateManager) CreateNextSnapshotHash(block *proto.Block) (crypto.Digest, error) { - const readOnly = true - blockchainHeight, err := s.Height() if err != nil { return crypto.Digest{}, err @@ -2025,7 +2023,7 @@ func (s *stateManager) CreateNextSnapshotHash(block *proto.Block) (crypto.Digest blockHeight := blockchainHeight + 1 // Generate blockchain fix snapshots for the given block in read only mode because all // changes has been already applied in the context of the last applied block. - fixSnapshots, gbfErr := s.generateBlockchainFix(blockHeight, block.BlockID(), readOnly) + fixSnapshots, gbfErr := s.generateBlockchainFix(blockHeight, block.BlockID(), true) if gbfErr != nil { return crypto.Digest{}, errors.Wrapf(gbfErr, "failed to generate blockchain fix snapshots at block %s", block.BlockID().String(), @@ -2038,7 +2036,7 @@ func (s *stateManager) CreateNextSnapshotHash(block *proto.Block) (crypto.Digest blockHeight, ) } - return s.appender.createNextSnapshotHash(block, blockHeight, lastSnapshotStateHash, fixSnapshots, readOnly) + return s.appender.createNextSnapshotHash(block, blockHeight, lastSnapshotStateHash, fixSnapshots) } func (s *stateManager) IsActiveLightNodeNewBlocksFields(blockHeight proto.Height) (bool, error) {