@@ -19,6 +19,7 @@ package multichain
19
19
import (
20
20
"github.com/hyperledger/fabric/common/configtx"
21
21
"github.com/hyperledger/fabric/common/policies"
22
+ "github.com/hyperledger/fabric/common/util"
22
23
"github.com/hyperledger/fabric/orderer/common/blockcutter"
23
24
"github.com/hyperledger/fabric/orderer/common/broadcast"
24
25
"github.com/hyperledger/fabric/orderer/common/deliver"
@@ -193,19 +194,6 @@ func (cs *chainSupport) CreateNextBlock(messages []*cb.Envelope) *cb.Block {
193
194
return rawledger .CreateNextBlock (cs .ledger , messages )
194
195
}
195
196
196
- // TODO, factor this out into common util code
197
- func metadataSignatureBytes (value []byte , sigHeader []byte , blockHeader []byte ) []byte {
198
- result := make ([]byte , len (value )+ len (sigHeader )+ len (blockHeader ))
199
- last := 0
200
- for _ , slice := range [][]byte {value , sigHeader , blockHeader } {
201
- for i := range slice {
202
- result [i + last ] = slice [i ]
203
- }
204
- last += len (slice )
205
- }
206
- return result
207
- }
208
-
209
197
func (cs * chainSupport ) addBlockSignature (block * cb.Block ) {
210
198
logger .Debugf ("%+v" , cs )
211
199
logger .Debugf ("%+v" , cs .signer )
@@ -217,7 +205,7 @@ func (cs *chainSupport) addBlockSignature(block *cb.Block) {
217
205
// information required beyond the fact that the metadata item is signed.
218
206
blockSignatureValue := []byte (nil )
219
207
220
- blockSignature .Signature = cs .signer .Sign (metadataSignatureBytes (blockSignatureValue , blockSignature .SignatureHeader , block .Header .Bytes ()))
208
+ blockSignature .Signature = cs .signer .Sign (util . ConcatenateBytes (blockSignatureValue , blockSignature .SignatureHeader , block .Header .Bytes ()))
221
209
222
210
block .Metadata .Metadata [cb .BlockMetadataIndex_SIGNATURES ] = utils .MarshalOrPanic (& cb.Metadata {
223
211
Value : blockSignatureValue ,
@@ -240,7 +228,7 @@ func (cs *chainSupport) addLastConfigSignature(block *cb.Block) {
240
228
241
229
lastConfigValue := utils .MarshalOrPanic (& cb.LastConfiguration {Index : cs .lastConfiguration })
242
230
243
- lastConfigSignature .Signature = cs .signer .Sign (metadataSignatureBytes (lastConfigValue , lastConfigSignature .SignatureHeader , block .Header .Bytes ()))
231
+ lastConfigSignature .Signature = cs .signer .Sign (util . ConcatenateBytes (lastConfigValue , lastConfigSignature .SignatureHeader , block .Header .Bytes ()))
244
232
245
233
block .Metadata .Metadata [cb .BlockMetadataIndex_LAST_CONFIGURATION ] = utils .MarshalOrPanic (& cb.Metadata {
246
234
Value : lastConfigValue ,
0 commit comments