Skip to content

Commit

Permalink
[FAB-1092] Illegal genesis message
Browse files Browse the repository at this point in the history
When the kafka package was merged, we hadn't settled on a block format,
and when the block format got finalized these changes weren't applied to
the kafka package. As an interim solution, since this entire package is
being reworked to support multiple chains and the factoring out of common
components between the kafka and solo packages, this changeset hooks
*directly* into the static bootstrapper to provide a valid genesis block.

Change-Id: Ieb542e9293b31dcd3f4c8c53d422c734a49a9886
Signed-off-by: Kostas Christidis <kostas@christidis.io>
  • Loading branch information
kchristidis committed Nov 19, 2016
1 parent b32680e commit 8a64889
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions orderer/kafka/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"sync"
"time"

"golang.org/x/net/context"

"github.com/hyperledger/fabric/orderer/common/bootstrap/static"
"github.com/hyperledger/fabric/orderer/config"
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
"golang.org/x/net/context"

"github.com/golang/protobuf/proto"
)
Expand All @@ -47,12 +47,17 @@ type broadcasterImpl struct {
prevHash []byte
}

type broadcastSessionResponder struct {
queue chan *ab.BroadcastResponse
}

func newBroadcaster(conf *config.TopLevel) Broadcaster {
genesisBlock, _ := static.New().GenesisBlock()
return &broadcasterImpl{
producer: newProducer(conf),
config: conf,
batchChan: make(chan *cb.Envelope, conf.General.BatchSize),
messages: [][]byte{[]byte("genesis")},
messages: genesisBlock.GetData().Data,
nextNumber: 0,
}
}
Expand Down Expand Up @@ -98,7 +103,6 @@ func (b *broadcasterImpl) sendBlock() error {
b.prevHash = block.Header.Hash()

blockBytes, err := proto.Marshal(block)

if err != nil {
logger.Fatalf("Error marshaling block: %s", err)
}
Expand Down Expand Up @@ -154,10 +158,6 @@ func (b *broadcasterImpl) recvRequests(stream ab.AtomicBroadcast_BroadcastServer
}
}

type broadcastSessionResponder struct {
queue chan *ab.BroadcastResponse
}

func newBroadcastSessionResponder(context context.Context, stream ab.AtomicBroadcast_BroadcastServer, queueSize uint) *broadcastSessionResponder {
bsr := &broadcastSessionResponder{
queue: make(chan *ab.BroadcastResponse, queueSize),
Expand Down

0 comments on commit 8a64889

Please sign in to comment.