lnwallet: add additional BlockChainIO methods
This commit is contained in:
1 parent
b440005219
commit
1119d75996
2 files changed
+34
-2
No files matched your search
@@ -53,3 +53,28 @@ func (b *BtcWallet) GetTransaction(txid *wire.ShaHash) (*wire.MsgTx, error) {
|
|||||||
|
|
||||||
return tx.MsgTx(), nil
|
return tx.MsgTx(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetBlock returns a raw block from the server given its hash.
|
||||||
|
//
|
||||||
|
// This method is a part of the lnwallet.BlockChainIO interface.
|
||||||
|
func (b *BtcWallet) GetBlock(blockHash *wire.ShaHash) (*wire.MsgBlock, error) {
|
||||||
|
block, err := b.rpc.GetBlock(blockHash)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return block, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetBlockHash returns the hash of the block in the best block chain at the
|
||||||
|
// given height.
|
||||||
|
//
|
||||||
|
// This method is a part of the lnwallet.BlockChainIO interface.
|
||||||
|
func (b *BtcWallet) GetBlockHash(blockHeight int64) (*wire.ShaHash, error) {
|
||||||
|
blockHash, err := b.rpc.GetBlockHash(blockHeight)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return blockHash, nil
|
||||||
|
}
|
||||||
@@ -210,8 +210,15 @@ type BlockChainIO interface {
|
|||||||
GetUtxo(txid *wire.ShaHash, index uint32) (*wire.TxOut, error)
|
GetUtxo(txid *wire.ShaHash, index uint32) (*wire.TxOut, error)
|
||||||
|
|
||||||
// GetTransaction returns the full transaction identified by the passed
|
// GetTransaction returns the full transaction identified by the passed
|
||||||
// transaction ID.
|
// transaction ID.
|
||||||
GetTransaction(txid *wire.ShaHash) (*wire.MsgTx, error)
|
GetTransaction(txid *wire.ShaHash) (*wire.MsgTx, error)
|
||||||
|
|
||||||
|
// GetBlockHash returns the hash of the block in the best block chain at the
|
||||||
|
// given height.
|
||||||
|
GetBlockHash(blockHeight int64) (*wire.ShaHash, error)
|
||||||
|
|
||||||
|
// GetBlock returns a block by the given hash.
|
||||||
|
GetBlock(blockHash *wire.ShaHash) (*wire.MsgBlock, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignDescriptor houses the necessary information required to successfully sign
|
// SignDescriptor houses the necessary information required to successfully sign
|
||||||
|
|||||||
Reference in new issue
Block a user