コード例 #1
0
ファイル: backendab.go プロジェクト: hyperledger/fabric
func NewBackendAB(backend *Backend) *BackendAB {

	// XXX All the code below is a hacky shim until sbft can be adapter to the new multichain interface
	it, _ := backend.ledger.Iterator(ab.SeekInfo_OLDEST, 0)
	block, status := it.Next()
	if status != cb.Status_SUCCESS {
		panic("Error getting a block from the ledger")
	}
	env := &cb.Envelope{}
	err := proto.Unmarshal(block.Data.Data[0], env)
	if err != nil {
		panic(err)
	}

	payload := &cb.Payload{}
	err = proto.Unmarshal(env.Payload, payload)
	if err != nil {
		panic(err)
	}

	manager := &xxxSupportManager{
		chainID: payload.Header.ChainHeader.ChainID,
		support: &xxxSupport{reader: backend.ledger},
	}
	// XXX End hackiness

	bab := &BackendAB{
		backend:       backend,
		deliverserver: deliver.NewHandlerImpl(manager, 1000),
	}
	return bab
}
コード例 #2
0
ファイル: server.go プロジェクト: hyperledger/fabric
// NewServer creates a ab.AtomicBroadcastServer based on the broadcast target and ledger Reader
func NewServer(ml multichain.Manager, queueSize, maxWindowSize int) ab.AtomicBroadcastServer {
	logger.Infof("Starting orderer")

	s := &server{
		dh: deliver.NewHandlerImpl(deliverSupport{ml}, maxWindowSize),
		bh: broadcast.NewHandlerImpl(broadcastSupport{ml}, queueSize),
	}
	return s
}