func NewShardStateManager(stateDB csmt.TreeDatabase, stateSlot uint64, tipBlockHash chainhash.Hash, shardInfo ShardInfo) *ShardStateManager {
	stateHash, err := stateDB.Hash()
	if err != nil {
		panic(err)
	}

	tip := &stateInfo{
		db: stateDB,
		state: State{
			SmartContractRoot:   *stateHash,
			LastCrosslinkHash:   chainhash.Hash{},
			ProposerAssignments: []bls.PublicKey{},
		},
		hash: tipBlockHash,
		slot: stateSlot,
	}

	return &ShardStateManager{
		finalizedDB: tip,
		tipDB:       tip,
		shardInfo:   shardInfo,
		stateMap: map[chainhash.Hash]*stateInfo{
			tipBlockHash: tip,
		},
		stateLock: new(sync.RWMutex),
	}
}
// NewShardStateManager constructs a new shard state manager which keeps track of shard state.
NewShardStateManager constructs a new shard state manager which keeps track of shard state.
// NewShardStateManager constructs a new shard state manager which keeps track of shard state .
func NewShardStateManager(stateDB csmt.TreeDatabase, stateSlot uint64, tipBlockHash chainhash.Hash, shardInfo ShardInfo) *ShardStateManager {
	stateHash, err := stateDB.Hash()
	if err != nil {
		panic(err)
	}
	tip := &stateInfo{
		db: stateDB,
		state: State{
			SmartContractRoot:   *stateHash,
			LastCrosslinkHash:   chainhash.Hash{},
			ProposerAssignments: []bls.PublicKey{},
		},
		hash: tipBlockHash,
		slot: stateSlot,
	}
	return &ShardStateManager{
		finalizedDB: tip,
		tipDB:       tip,
		shardInfo:   shardInfo,
		stateMap: map[chainhash.Hash]*stateInfo{
			tipBlockHash: tip,
		},
		stateLock: new(sync.RWMutex),
	}
}
func NewShardStateManager ( stateDB csmt . TreeDatabase , stateSlot uint64 , tipBlockHash chainhash . Hash , shardInfo ShardInfo ) * ShardStateManager { stateHash , err := stateDB . Hash ( ) if err != nil { panic ( err ) } tip := & stateInfo { db : stateDB , state : State { SmartContractRoot : * stateHash , LastCrosslinkHash : chainhash . Hash { } , ProposerAssignments : [ ] bls . PublicKey { } , } , hash : tipBlockHash , slot : stateSlot , } return & ShardStateManager { finalizedDB : tip , tipDB : tip , shardInfo : shardInfo , stateMap : map [ chainhash . Hash ] * stateInfo { tipBlockHash : tip , } , stateLock : new ( sync . RWMutex ) , } }
NewShardStateManager constructs a new shard state manager which keeps track of shard state.
NewShardStateManager constructs a new shard state manager which keeps track of shard state .