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

+4 -9
View File
@@ -6,17 +6,12 @@ import (
"github.com/roasbeef/btcd/wire"
)
// GetCurrentHeight returns the current height of the known block within the
// main chain.
// GetBestBlock returns the current height and hash of the best known block
// within the main chain.
//
// This method is a part of the lnwallet.BlockChainIO interface.
func (b *BtcWallet) GetCurrentHeight() (int32, error) {
_, height, err := b.rpc.GetBestBlock()
if err != nil {
return 0, err
}
return height, nil
func (b *BtcWallet) GetBestBlock() (*wire.ShaHash, int32, error) {
return b.rpc.GetBestBlock()
}
// GetTxOut returns the original output referenced by the passed outpoint.