mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-01 02:51:37 +02:00
chainntnfs/interface: add ChainConn interface
This allows notifiers to pass their chain backend into interface functions to retrieve information from the chain.
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/btcjson"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
)
|
)
|
||||||
@ -253,3 +254,17 @@ func SupportedNotifiers() []string {
|
|||||||
|
|
||||||
return supportedNotifiers
|
return supportedNotifiers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ChainConn enables notifiers to pass in their chain backend to interface
|
||||||
|
// functions that require it.
|
||||||
|
type ChainConn interface {
|
||||||
|
// GetBlockHeader returns the block header for a hash.
|
||||||
|
GetBlockHeader(blockHash *chainhash.Hash) (*wire.BlockHeader, error)
|
||||||
|
|
||||||
|
// GetBlockHeaderVerbose returns the verbose block header for a hash.
|
||||||
|
GetBlockHeaderVerbose(blockHash *chainhash.Hash) (
|
||||||
|
*btcjson.GetBlockHeaderVerboseResult, error)
|
||||||
|
|
||||||
|
// GetBlockHash returns the hash from a block height.
|
||||||
|
GetBlockHash(blockHeight int64) (*chainhash.Hash, error)
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user