Open yfhk opened 5 years ago
func (r Registrar) newChain(configtx cb.Envelope) { ledgerResources := r.newLedgerResources(configtx) ledgerResources.Append(blockledger.CreateNextBlock(ledgerResources, []*cb.Envelope{configtx}))
// Copy the map to allow concurrent reads from broadcast/deliver while the new chainSupport is
newChains := make(map[string]*ChainSupport)
for key, value := range r.chains {
newChains[key] = value
}
cs := newChainSupport(r, ledgerResources, r.consenters, r.signer)
chainID := ledgerResources.ConfigtxValidator().ChainID()
logger.Infof("Created and starting new chain %s", chainID)
newChains[string(chainID)] = cs
cs.start()
r.chains = newChains
}
// WriteConfigBlock should be invoked for blocks which contain a config transaction. // This call will block until the new config has taken effect, then will return // while the block is written asynchronously to disk. func (bw BlockWriter) WriteConfigBlock(block cb.Block, encodedMetadataValue []byte) { ctx, err := utils.ExtractEnvelope(block, 0) if err != nil { logger.Panicf("Told to write a config block, but could not get configtx: %s", err) }
}