Skip to content

Commit 19ad687

Browse files
committed
[FAB-1775] Store most recent block in mock struct
https://jira.hyperledger.org/browse/FAB-1775 Store the results of the most recent `CreateNextBlock()` and `WriteBlock()` calls in the mock `ConsenterSupport` structure so as to make these values easier to retrieve (and some tests easier to write*). * I will be using this in a test on [FAB-1623]. Change-Id: If678308e25f73112809867768c4b89052fd3f283 Signed-off-by: Kostas Christidis <[email protected]>
1 parent 4b0176a commit 19ad687

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

orderer/mocks/multichain/multichain.go

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ type ConsenterSupport struct {
4444

4545
// ChainIDVal is the value returned by ChainID()
4646
ChainIDVal string
47+
48+
// NextBlockVal stores the block created by the most recent CreateNextBlock() call
49+
NextBlockVal *cb.Block
50+
51+
// WriteBlockVal stores the block created by the most recent WriteBlock() call
52+
WriteBlockVal *cb.Block
4753
}
4854

4955
// BlockCutter returns BlockCutterVal
@@ -64,6 +70,7 @@ func (mcs *ConsenterSupport) CreateNextBlock(data []*cb.Envelope) *cb.Block {
6470
mtxs[i] = utils.MarshalOrPanic(data[i])
6571
}
6672
block.Data = &cb.BlockData{Data: mtxs}
73+
mcs.NextBlockVal = block
6774
return block
6875
}
6976

@@ -77,6 +84,7 @@ func (mcs *ConsenterSupport) WriteBlock(block *cb.Block, _committers []filter.Co
7784
}
7885
mcs.Batches <- umtxs
7986
block.Metadata.Metadata[cb.BlockMetadataIndex_ORDERER] = utils.MarshalOrPanic(&cb.Metadata{Value: encodedMetadataValue})
87+
mcs.WriteBlockVal = block
8088
return block
8189
}
8290

0 commit comments

Comments
 (0)