code: func (tx *transaction) fetchPendingRegion(region *database.BlockRegion) ([]byte, error) {
  	// Nothing to do if the block is not pending to be written on commit.
  	idx, exists := tx.pendingBlocks[*region.Hash]
  	if !exists {
  		return nil, nil
  	}
  
  	// Ensure the region is within the bounds of the block.
  	blockBytes := tx.pendingBlockData[idx].bytes
  	blockLen := uint32(len(blockBytes))
  	endOffset := region.Offset + region.Len
  	if endOffset < region.Offset || endOffset > blockLen {
  		str := fmt.Sprintf("block %s region offset %d, length %d "+
  			"exceeds block length of %d", region.Hash,
  			region.Offset, region.Len, blockLen)
  		return nil, makeDbErr(database.ErrBlockRegionInvalid, str, nil)
  	}
  
  	// Return the bytes from the pending block.
  	return blockBytes[region.Offset:endOffset:endOffset], nil
  }
docs: // fetchPendingRegion attempts to fetch the provided region from any block which
  // are pending to be written on commit.  It will return nil for the byte slice
  // when the region references a block which is not pending.  When the region
  // does reference a pending block, it is bounds checked and returns
  // ErrBlockRegionInvalid if invalid.