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
2016-12-22 12:34:51 -08:00
parent 3d32c4e90e
commit 782fc61dc1
4 changed files with 33 additions and 34 deletions

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