Skip to content

Commit 8a64889

Browse files
committed
[FAB-1092] Illegal genesis message
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 <[email protected]>
1 parent b32680e commit 8a64889

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

orderer/kafka/broadcast.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import (
2121
"sync"
2222
"time"
2323

24-
"golang.org/x/net/context"
25-
24+
"github.com/hyperledger/fabric/orderer/common/bootstrap/static"
2625
"github.com/hyperledger/fabric/orderer/config"
2726
cb "github.com/hyperledger/fabric/protos/common"
2827
ab "github.com/hyperledger/fabric/protos/orderer"
28+
"golang.org/x/net/context"
2929

3030
"github.com/golang/protobuf/proto"
3131
)
@@ -47,12 +47,17 @@ type broadcasterImpl struct {
4747
prevHash []byte
4848
}
4949

50+
type broadcastSessionResponder struct {
51+
queue chan *ab.BroadcastResponse
52+
}
53+
5054
func newBroadcaster(conf *config.TopLevel) Broadcaster {
55+
genesisBlock, _ := static.New().GenesisBlock()
5156
return &broadcasterImpl{
5257
producer: newProducer(conf),
5358
config: conf,
5459
batchChan: make(chan *cb.Envelope, conf.General.BatchSize),
55-
messages: [][]byte{[]byte("genesis")},
60+
messages: genesisBlock.GetData().Data,
5661
nextNumber: 0,
5762
}
5863
}
@@ -98,7 +103,6 @@ func (b *broadcasterImpl) sendBlock() error {
98103
b.prevHash = block.Header.Hash()
99104

100105
blockBytes, err := proto.Marshal(block)
101-
102106
if err != nil {
103107
logger.Fatalf("Error marshaling block: %s", err)
104108
}
@@ -154,10 +158,6 @@ func (b *broadcasterImpl) recvRequests(stream ab.AtomicBroadcast_BroadcastServer
154158
}
155159
}
156160

157-
type broadcastSessionResponder struct {
158-
queue chan *ab.BroadcastResponse
159-
}
160-
161161
func newBroadcastSessionResponder(context context.Context, stream ab.AtomicBroadcast_BroadcastServer, queueSize uint) *broadcastSessionResponder {
162162
bsr := &broadcastSessionResponder{
163163
queue: make(chan *ab.BroadcastResponse, queueSize),

0 commit comments

Comments
 (0)