task: metadata: install: pip install -e .[test]
patch: diff --git a/hive/indexer/accounts.py b/hive/indexer/accounts.py
index 3c8de1b..485320c 100644
--- a/hive/indexer/accounts.py
+++ b/hive/indexer/accounts.py
@@ -186,6 +186,7 @@ class Accounts:
         # pull out valid profile md and delete the key
         profile = safe_profile_metadata(account)
         del account['json_metadata']
+        del account['posting_json_metadata']
 
         active_at = max(account['created'],
                         account['last_account_update'],
diff --git a/hive/utils/account.py b/hive/utils/account.py
index fe1302d..caf3830 100644
--- a/hive/utils/account.py
+++ b/hive/utils/account.py
@@ -6,12 +6,19 @@ from hive.utils.normalize import trunc
 def safe_profile_metadata(account):
     """Given an account, return sanitized profile data."""
     prof = {}
+
     try:
-        prof = json.loads(account['json_metadata'])['profile']
-        if not isinstance(prof, dict):
-            prof = {}
+        # read from posting_json_metadata, if version==2
+        prof = json.loads(account['posting_json_metadata'])['profile']
+        assert isinstance(prof, dict)
+        assert 'version' in prof and prof['version'] == 2
     except Exception:
-        pass
+        try:
+            # fallback to json_metadata
+            prof = json.loads(account['json_metadata'])['profile']
+            assert isinstance(prof, dict)
+        except Exception:
+            prof = {}
 
     name = str(prof['name']) if 'name' in prof else None
     about = str(prof['about']) if 'about' in prof else None

problem_statement: Support for account_update2 / posting_json_metadata
I broadcasted posting_json_metadata using the new account_update2 operation (https://steemd.com/@tftest1), but unlike when broadcasting json_metadata, this does not change the information that are indexed in hive_accounts
repo: steemit/hivemind
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/utils/test_utils_account.py b/tests/utils/test_utils_account.py
index b112e11..deb0db1 100644
--- a/tests/utils/test_utils_account.py
+++ b/tests/utils/test_utils_account.py
@@ -11,8 +11,9 @@ def test_valid_account():
         website='http://www.davincilife.com/',
         cover_image='https://steemitimages.com/0x0/https://pbs.twimg.com/profile_banners/816255358066946050/1483447009/1500x500',
         profile_image='https://www.parhlo.com/wp-content/uploads/2016/01/tmp617041537745813506.jpg',
+        version=2,
     )
-    account = {'name': 'foo', 'json_metadata': json.dumps(dict(profile=raw_profile))}
+    account = {'name': 'foo', 'posting_json_metadata': json.dumps(dict(profile=raw_profile))}
 
     safe_profile = safe_profile_metadata(account)
     for key, safe_value in safe_profile.items():
@@ -26,7 +27,11 @@ def test_invalid_account():
         cover_image='example.com/avatar.jpg',
         profile_image='https://example.com/valid-url-but-longer-than-1024-chars' + 'x' * 1024,
     )
-    account = {'name': 'foo', 'json_metadata': json.dumps(dict(profile=raw_profile))}
+    ignore_prof = dict(
+        name='Ignore me -- missing version:2!',
+    )
+    account = {'name': 'foo', 'json_metadata': json.dumps(dict(profile=raw_profile)),
+               'posting_json_metadata': json.dumps(dict(profile=ignore_prof))}
 
     safe_profile = safe_profile_metadata(account)
     assert safe_profile['name'] == 'NameIsTooBigByOne...'