lnwallet+lnrpc: convert GetCurrentHeight to GetBestBlock in BlockChainIO

This commit expands the data returned by the current GetCurrentHeight
to also return the current best block hash, expanding the method into
GetBestBlock. Additionally, the current best BlockHash is also now
displayed within the GetInfo RPC call.
This commit is contained in:
Olaoluwa Osuntokun committed 2016-12-27 16:43:26 -08:00
1 parent 3d32c4e90e
commit 782fc61dc1
4 files changed
+33 -34

No files matched your search

+3 -2
View File
@@ -422,7 +422,7 @@ func (r *rpcServer) GetInfo(ctx context.Context,
pendingChannels := r.server.fundingMgr.NumPendingChannels()
idPub := r.server.identityPriv.PubKey().SerializeCompressed()
currentHeight, err := r.server.bio.GetCurrentHeight()
bestHash, bestHeight, err := r.server.bio.GetBestBlock()
if err != nil {
return nil, err
}
@@ -437,7 +437,8 @@ func (r *rpcServer) GetInfo(ctx context.Context,
NumPendingChannels: pendingChannels,
NumActiveChannels: activeChannels,
NumPeers: uint32(len(serverPeers)),
BlockHeight: uint32(currentHeight),
BlockHeight: uint32(bestHeight),
BlockHash: bestHash.String(),
SyncedToChain: isSynced,
Testnet: activeNetParams.Params == &chaincfg.TestNet3Params,
}, nil