code: func decodeSpentTxOut(serialized []byte, stxo *SpentTxOut) (int, error) {
  	// Ensure there are bytes to decode.
  	if len(serialized) == 0 {
  		return 0, errDeserialize("no serialized bytes")
  	}
  
  	// Deserialize the header code.
  	code, offset := deserializeVLQ(serialized)
  	if offset >= len(serialized) {
  		return offset, errDeserialize("unexpected end of data after " +
  			"header code")
  	}
  
  	// Decode the header code.
  	//
  	// Bit 0 indicates containing transaction is a coinbase.
  	// Bits 1-x encode height of containing transaction.
  	stxo.IsCoinBase = code&0x01 != 0
  	stxo.Height = int32(code >> 1)
  	if stxo.Height > 0 {
  		// The legacy v1 spend journal format conditionally tracked the
  		// containing transaction version when the height was non-zero,
  		// so this is required for backwards compat.
  		_, bytesRead := deserializeVLQ(serialized[offset:])
  		offset += bytesRead
  		if offset >= len(serialized) {
  			return offset, errDeserialize("unexpected end of data " +
  				"after reserved")
  		}
  	}
  
  	// Decode the compressed txout.
  	amount, pkScript, bytesRead, err := decodeCompressedTxOut(
  		serialized[offset:])
  	offset += bytesRead
  	if err != nil {
  		return offset, errDeserialize(fmt.Sprintf("unable to decode "+
  			"txout: %v", err))
  	}
  	stxo.Amount = int64(amount)
  	stxo.PkScript = pkScript
  	return offset, nil
  }
docs: // decodeSpentTxOut decodes the passed serialized stxo entry, possibly followed
  // by other data, into the passed stxo struct.  It returns the number of bytes
  // read.