multi: add GetBlockHeader to BlockChainIO

This commit is contained in:
Jonathan Harvey-Buschel committed 2023-10-27 11:05:27 -04:00
1 parent 7a8803e3cf
commit 6edd1e1220
7 files changed
+61

No files matched your search

+14
View File
@@ -228,6 +228,20 @@ func (m *mockChain) GetBlock(blockHash *chainhash.Hash) (*wire.MsgBlock, error)
return block, nil
}
func (m *mockChain) GetBlockHeader(
blockHash *chainhash.Hash) (*wire.BlockHeader, error) {
m.RLock()
defer m.RUnlock()
block, ok := m.blocks[*blockHash]
if !ok {
return nil, fmt.Errorf("block not found")
}
return &block.Header, nil
}
type mockChainView struct {
sync.RWMutex