MCPcopy
hub / github.com/hyperledger/fabric / GetLedgerHeight

Function GetLedgerHeight

integration/nwo/deploy.go:542–559  ·  view source on GitHub ↗

GetLedgerHeight returns the current ledger height for a peer on a channel

(n *Network, peer *Peer, channel string)

Source from the content-addressed store, hash-verified

540// GetLedgerHeight returns the current ledger height for a peer on
541// a channel
542func GetLedgerHeight(n *Network, peer *Peer, channel string) int {
543 sess, err := n.PeerUserSession(peer, "User1", commands.ChannelInfo{
544 ChannelID: channel,
545 ClientAuth: n.ClientAuthRequired,
546 })
547 Expect(err).NotTo(HaveOccurred())
548 Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit())
549
550 if sess.ExitCode() == 1 {
551 // if org is not yet member of channel, peer will return error
552 return -1
553 }
554
555 channelInfoStr := strings.TrimPrefix(string(sess.Buffer().Contents()[:]), "Blockchain info:")
556 channelInfo := common.BlockchainInfo{}
557 json.Unmarshal([]byte(channelInfoStr), &channelInfo)
558 return int(channelInfo.Height)
559}
560
561// GetMaxLedgerHeight returns the maximum ledger height for the
562// peers on a channel

Callers 15

pvtdata_test.goFile · 0.92
addPeerFunction · 0.92
writeImplicitCollectionFunction · 0.92
AddMarbleFunction · 0.92
DeleteMarbleFunction · 0.92
PurgeMarbleFunction · 0.92
SetMarblePolicyFunction · 0.92
TransferMarbleFunction · 0.92
data_purge_test.goFile · 0.92
addPeerFunction · 0.92
assertPeersLedgerHeightFunction · 0.92

Calls 3

PeerUserSessionMethod · 0.80
UnmarshalMethod · 0.65
BufferMethod · 0.45

Tested by 9

addPeerFunction · 0.74
writeImplicitCollectionFunction · 0.74
addPeerFunction · 0.74
assertPeersLedgerHeightFunction · 0.74