multi: add GetBlockHeader to BlockChainIO

This commit is contained in:
Jonathan Harvey-Buschel
2023-10-26 12:09:56 -04:00
committed by Olaoluwa Osuntokun
parent 35bfd27467
commit b04927f688
7 changed files with 61 additions and 0 deletions

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