@@ -310,7 +310,7 @@ func (bc *Blockchain) processBlockPoS(block *MsgDeSoBlock, currentView uint64, v
310
310
311
311
// We expect the utxoView for the parent block to be valid because we check that all ancestor blocks have
312
312
// been validated.
313
- parentUtxoViewAndUtxoOps , err := bc .getUtxoViewAndUtxoOpsAtBlockHash (* block .Header .PrevBlockHash )
313
+ parentUtxoViewAndUtxoOps , err := bc .GetUtxoViewAndUtxoOpsAtBlockHash (* block .Header .PrevBlockHash )
314
314
if err != nil {
315
315
// This should never happen. If the parent is validated and extends from the tip, then we should
316
316
// be able to build a UtxoView for it. This failure can only happen due to transient or badger issues.
@@ -814,7 +814,7 @@ func (bc *Blockchain) validatePreviouslyIndexedBlockPoS(
814
814
return nil , errors .Wrapf (err , "validatePreviouslyIndexedBlockPoS: Problem fetching block from DB" )
815
815
}
816
816
// Build utxoView for the block's parent.
817
- parentUtxoViewAndUtxoOps , err := bc .getUtxoViewAndUtxoOpsAtBlockHash (* block .Header .PrevBlockHash )
817
+ parentUtxoViewAndUtxoOps , err := bc .GetUtxoViewAndUtxoOpsAtBlockHash (* block .Header .PrevBlockHash )
818
818
if err != nil {
819
819
// This should never happen. If the parent is validated and extends from the tip, then we should
820
820
// be able to build a UtxoView for it. This failure can only happen due to transient or badger issues.
@@ -1720,7 +1720,7 @@ func (bc *Blockchain) commitBlockPoS(blockHash *BlockHash, verifySignatures bool
1720
1720
return errors .Errorf ("commitBlockPoS: Block %v is already committed" , blockHash .String ())
1721
1721
}
1722
1722
// Connect a view up to block we are committing.
1723
- utxoViewAndUtxoOps , err := bc .getUtxoViewAndUtxoOpsAtBlockHash (* blockHash )
1723
+ utxoViewAndUtxoOps , err := bc .GetUtxoViewAndUtxoOpsAtBlockHash (* blockHash )
1724
1724
if err != nil {
1725
1725
return errors .Wrapf (err , "commitBlockPoS: Problem initializing UtxoView: " )
1726
1726
}
@@ -1892,7 +1892,7 @@ func (viewAndUtxoOps *BlockViewAndUtxoOps) Copy() *BlockViewAndUtxoOps {
1892
1892
// GetUncommittedTipView builds a UtxoView to the uncommitted tip.
1893
1893
func (bc * Blockchain ) GetUncommittedTipView () (* UtxoView , error ) {
1894
1894
// Connect the uncommitted blocks to the tip so that we can validate subsequent blocks
1895
- blockViewAndUtxoOps , err := bc .getUtxoViewAndUtxoOpsAtBlockHash (* bc .BlockTip ().Hash )
1895
+ blockViewAndUtxoOps , err := bc .GetUtxoViewAndUtxoOpsAtBlockHash (* bc .BlockTip ().Hash )
1896
1896
if err != nil {
1897
1897
return nil , errors .Wrapf (err , "GetUncommittedTipView: Problem getting UtxoView at block hash" )
1898
1898
}
@@ -1906,56 +1906,56 @@ func (bc *Blockchain) getCachedBlockViewAndUtxoOps(blockHash BlockHash) (*BlockV
1906
1906
return nil , nil , false
1907
1907
}
1908
1908
1909
- // getUtxoViewAndUtxoOpsAtBlockHash builds a UtxoView to the block provided and returns a BlockViewAndUtxoOps
1909
+ // GetUtxoViewAndUtxoOpsAtBlockHash builds a UtxoView to the block provided and returns a BlockViewAndUtxoOps
1910
1910
// struct containing UtxoView, the UtxoOperations that resulted from connecting the block, and the full
1911
1911
// block (MsgDeSoBlock) for convenience that came from connecting the block. It does this by identifying
1912
1912
// all uncommitted ancestors of this block. Then it checks the block view cache to see if we have already
1913
1913
// computed this view. If not, connecting the uncommitted ancestor blocks and saving to the cache. The
1914
1914
// returned UtxoOps and FullBlock should NOT be modified.
1915
- func (bc * Blockchain ) getUtxoViewAndUtxoOpsAtBlockHash (blockHash BlockHash ) (
1915
+ func (bc * Blockchain ) GetUtxoViewAndUtxoOpsAtBlockHash (blockHash BlockHash ) (
1916
1916
* BlockViewAndUtxoOps , error ) {
1917
1917
// Always fetch the lineage from the committed tip to the block provided first to
1918
1918
// ensure that a valid UtxoView is returned.
1919
1919
uncommittedAncestors := []* BlockNode {}
1920
1920
currentBlock , _ := bc .blockIndexByHash .Get (blockHash )
1921
1921
if currentBlock == nil {
1922
- return nil , errors .Errorf ("getUtxoViewAndUtxoOpsAtBlockHash : Block %v not found in block index" , blockHash )
1922
+ return nil , errors .Errorf ("GetUtxoViewAndUtxoOpsAtBlockHash : Block %v not found in block index" , blockHash )
1923
1923
}
1924
1924
1925
1925
highestCommittedBlock , _ := bc .GetCommittedTip ()
1926
1926
if highestCommittedBlock == nil {
1927
- return nil , errors .Errorf ("getUtxoViewAndUtxoOpsAtBlockHash : No committed blocks found" )
1927
+ return nil , errors .Errorf ("GetUtxoViewAndUtxoOpsAtBlockHash : No committed blocks found" )
1928
1928
}
1929
1929
// If the provided block is committed, we need to make sure it's the committed tip.
1930
1930
// Otherwise, we return an error.
1931
1931
if currentBlock .IsCommitted () {
1932
1932
if ! highestCommittedBlock .Hash .IsEqual (& blockHash ) {
1933
1933
return nil , errors .Errorf (
1934
- "getUtxoViewAndUtxoOpsAtBlockHash : Block %v is committed but not the committed tip" , blockHash )
1934
+ "GetUtxoViewAndUtxoOpsAtBlockHash : Block %v is committed but not the committed tip" , blockHash )
1935
1935
}
1936
1936
}
1937
1937
for ! currentBlock .IsCommitted () {
1938
1938
uncommittedAncestors = append (uncommittedAncestors , currentBlock )
1939
1939
currentParentHash := currentBlock .Header .PrevBlockHash
1940
1940
if currentParentHash == nil {
1941
- return nil , errors .Errorf ("getUtxoViewAndUtxoOpsAtBlockHash : Block %v has nil PrevBlockHash" , currentBlock .Hash )
1941
+ return nil , errors .Errorf ("GetUtxoViewAndUtxoOpsAtBlockHash : Block %v has nil PrevBlockHash" , currentBlock .Hash )
1942
1942
}
1943
1943
currentBlock , _ = bc .blockIndexByHash .Get (* currentParentHash )
1944
1944
if currentBlock == nil {
1945
- return nil , errors .Errorf ("getUtxoViewAndUtxoOpsAtBlockHash : Block %v not found in block index" , currentParentHash )
1945
+ return nil , errors .Errorf ("GetUtxoViewAndUtxoOpsAtBlockHash : Block %v not found in block index" , currentParentHash )
1946
1946
}
1947
1947
if currentBlock .IsCommitted () && ! currentBlock .Hash .IsEqual (highestCommittedBlock .Hash ) {
1948
1948
return nil , errors .Errorf (
1949
- "getUtxoViewAndUtxoOpsAtBlockHash : extends from a committed block that isn't the committed tip" )
1949
+ "GetUtxoViewAndUtxoOpsAtBlockHash : extends from a committed block that isn't the committed tip" )
1950
1950
}
1951
1951
if currentBlock .IsCommitted () && ! currentBlock .Hash .IsEqual (highestCommittedBlock .Hash ) {
1952
1952
return nil , errors .Errorf (
1953
- "getUtxoViewAndUtxoOpsAtBlockHash : extends from a committed block that isn't the committed tip" )
1953
+ "GetUtxoViewAndUtxoOpsAtBlockHash : extends from a committed block that isn't the committed tip" )
1954
1954
}
1955
1955
}
1956
1956
viewAndUtxoOpsAtHash , err , exists := bc .getCachedBlockViewAndUtxoOps (blockHash )
1957
1957
if err != nil {
1958
- return nil , errors .Wrapf (err , "getUtxoViewAndUtxoOpsAtBlockHash : Problem getting cached BlockViewAndUtxoOps" )
1958
+ return nil , errors .Wrapf (err , "GetUtxoViewAndUtxoOpsAtBlockHash : Problem getting cached BlockViewAndUtxoOps" )
1959
1959
}
1960
1960
if exists {
1961
1961
viewAndUtxoOpsCopy := viewAndUtxoOpsAtHash .Copy ()
0 commit comments