Skip to content

Commit b183fce

Browse files
committed
[FAB-6634] Filtered block should include type
This CR adds the block type (e.g. Config, Endorser_Transaction) to the filtered block. Change-Id: Iea60502c8fcda30a4811bf556a8dc09db76de922 Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
1 parent 2c89bb8 commit b183fce

File tree

3 files changed

+71
-57
lines changed

3 files changed

+71
-57
lines changed

events/producer/eventhelper.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func CreateBlockEvents(block *common.Block) (bevent *pb.Event, fbevent *pb.Event
3535
blockForEvent := &common.Block{}
3636
filteredBlockForEvent := &pb.FilteredBlock{}
3737
filteredTxArray := []*pb.FilteredTransaction{}
38+
var headerType common.HeaderType
3839
blockForEvent.Header = block.Header
3940
blockForEvent.Metadata = block.Metadata
4041
blockForEvent.Data = &common.BlockData{}
@@ -56,9 +57,11 @@ func CreateBlockEvents(block *common.Block) (bevent *pb.Event, fbevent *pb.Event
5657
if err != nil {
5758
return nil, nil, "", err
5859
}
60+
5961
channelID = chdr.ChannelId
62+
headerType = common.HeaderType(chdr.Type)
6063

61-
if common.HeaderType(chdr.Type) == common.HeaderType_ENDORSER_TRANSACTION {
64+
if headerType == common.HeaderType_ENDORSER_TRANSACTION {
6265
logger.Debugf("Channel [%s]: Block event for block number [%d] contains transaction id: %s", channelID, block.Header.Number, chdr.TxId)
6366
tx, err := utils.GetTransaction(payload.Data)
6467
if err != nil {
@@ -133,6 +136,7 @@ func CreateBlockEvents(block *common.Block) (bevent *pb.Event, fbevent *pb.Event
133136
}
134137
filteredBlockForEvent.ChannelId = channelID
135138
filteredBlockForEvent.Number = block.Header.Number
139+
filteredBlockForEvent.Type = headerType
136140
filteredBlockForEvent.FilteredTx = filteredTxArray
137141

138142
return CreateBlockEvent(blockForEvent), CreateFilteredBlockEvent(filteredBlockForEvent), channelID, nil

protos/peer/events.pb.go

+64-55
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protos/peer/events.proto

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ message Unregister {
8181
message FilteredBlock {
8282
string channel_id = 1;
8383
uint64 number = 2; // The position in the blockchain
84-
repeated FilteredTransaction filtered_tx = 3;
84+
common.HeaderType type = 3;
85+
repeated FilteredTransaction filtered_tx = 4;
8586
}
8687

8788
//FilteredTransaction is a minimal set of information about a transaction

0 commit comments

Comments
 (0)