-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-12508] Add Block(seq) to consenter support
This change set adds a method that retrieves a block from the ledger in the consenter support. Change-Id: Id088ec688e169d306c242352b485a8e47809b7db Signed-off-by: yacovm <[email protected]>
- Loading branch information
Showing
8 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package multichannel | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hyperledger/fabric/common/deliver/mock" | ||
"github.com/hyperledger/fabric/common/ledger/blockledger/mocks" | ||
"github.com/hyperledger/fabric/protos/common" | ||
"github.com/hyperledger/fabric/protos/orderer" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestChainSupportBlock(t *testing.T) { | ||
ledger := &mocks.ReadWriter{} | ||
ledger.On("Height").Return(uint64(100)) | ||
iterator := &mock.BlockIterator{} | ||
iterator.NextReturns(&common.Block{Header: &common.BlockHeader{Number: 99}}, common.Status_SUCCESS) | ||
ledger.On("Iterator", &orderer.SeekPosition{ | ||
Type: &orderer.SeekPosition_Specified{ | ||
Specified: &orderer.SeekSpecified{Number: 99}, | ||
}, | ||
}).Return(iterator, uint64(99)) | ||
cs := &ChainSupport{ledgerResources: &ledgerResources{ReadWriter: ledger}} | ||
|
||
assert.Nil(t, cs.Block(100)) | ||
assert.Equal(t, uint64(99), cs.Block(99).Header.Number) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters