title: Track states in Corda vault
body: <p>I'm interested in tracking vault updates for states. Whenever a state of a specific contract state type, say <code>Token</code>, is produced or consumed in a transaction, I want to receive an update. I use the following query criteria</p>
  <pre class="lang-kt prettyprint-override"><code>val queryCriteria = QueryCriteria.VaultQueryCriteria(Vault.StateStatus.ALL)
      .and(
           QueryCriteria.VaultQueryCriteria(
               timeCondition = QueryCriteria.TimeCondition(
                   QueryCriteria.TimeInstantType.RECORDED,
                   ColumnPredicate.BinaryComparison(
                        BinaryComparisonOperator.GREATER_THAN_OR_EQUAL,
                        offset
                   )
               )
           )
      )
  
  </code></pre>
  <p>together with</p>
  <pre class="lang-kt prettyprint-override"><code>ops.vaultTrackByWithSorting(
      TokenState::class.java,
      queryCriteria,
      Sort(
          setOf(
              Sort.SortColumn(
                  SortAttribute.Standard(Sort.VaultStateAttribute.RECORDED_TIME),
                  Sort.Direction.ASC
              ),
              Sort.SortColumn(
                  SortAttribute.Standard(Sort.CommonStateAttribute.STATE_REF_INDEX),
                  Sort.Direction.ASC
              )
          )
      )
  )
  </code></pre>
  <p>Interestingly, I do see updates which produce <code>Token</code>s, but I do not see any updates when <code>Token</code>s get consumed. I'm using Corda 4.6.</p>
  <p>I'm aware of the <code>_trackBy</code>'s limitations with respect to query criteria, however, according to Corda's vault api documentation, as I understand it, the above code should listen to both produced (<code>UNCONSUMED</code>) and consumed (<code>CONSUMED</code>) state updates. Is this a known bug, or am I doing something wrong?</p>