Skip to content

to support GetConfigBlockFromOrdererByNumber #124

Description

@1gezhanghao

For an exist channel , when a new org need to be added to channel:
the channel's configBlock is updated first, then the org's peers join the channel

code may like as follows

//code update the configblock
...
...

//code to get the latest configblock
block, err = channel.GetConfigBlockFromOrderer(context.Background(), orderer0.Conn, orderer0.Signer, channelID, orderer0.KeyPair)                                                                                                         
if err != nil {                                                                                                                                                                                                                           
        logger.Error(err)                                                                                                                                                                                                                 
        return err                                                                                                                                                                                                                        
}  
//code to make peer join the channel
err := channel.JoinChannel(block, peerCli.Signer, peer.NewEndorserClient(peerCli.Conn))                                                                                                                                           
if err != nil {                                                                                                                                                                                                                   
        logger.Error(err)                                                                                                                                                                                                                 
        return err                                                                                                                                                                                              
}                                                                                                                                                                                                                                 

JoinChannel(...) will give an error: unsuccessful response received with status 500 (INTERNAL_SERVER_ERROR): cannot create ledger from genesis block: expected block number=0, received block number=1

So when a peer join the channl it will always need the number 0 ConfigBlock, is it correct?
but channel.GetConfigBlockFromOrderer(...) always return the latest ConfigBlock
so we need a func like channel.GetConfigBlockFromOrdererByNumber(0) or channel.GetFirstConfigBlockFromOrderer() to get the first ConfigBlock to support peer join

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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