From bd24b9ef95925566b0c0c33e8a9a5af5f07fc577 Mon Sep 17 00:00:00 2001
From: ABW <andrzejl@syncad.com>
Date: Tue, 24 Nov 2020 17:18:51 +0100
Subject: [PATCH] WIP [ABW]: added some mocks for reblogs [Fix] corrected
 paging in bridge_get_account_posts_by_blog [Change]
 bridge_get_account_posts_by_blog reused for get_discussions_by_blog

---
 hive/db/schema.py                             |   1 -
 .../bridge_get_account_posts_by_blog.sql      |  31 +-
 .../condenser_get_discussions_by_blog.sql     | 141 ---------
 hive/db/sql_scripts/db_upgrade.sh             |   1 -
 hive/server/bridge_api/methods.py             |   2 +-
 hive/server/condenser_api/methods.py          |   6 +-
 hive/server/tags_api/methods.py               |   1 -
 .../follow_op/mock_block_data_follow.json     |   4 +-
 mock_data/block_data/reblog_op/flow.txt       |   4 +
 .../reblog_op/mock_block_data_reblog.json     | 271 ++++++++++++++++++
 scripts/ci/hive-sync.sh                       |   2 +-
 scripts/ci_sync.sh                            |   2 +-
 tests/tests_api                               |   2 +-
 13 files changed, 300 insertions(+), 168 deletions(-)
 delete mode 100644 hive/db/sql_scripts/condenser_get_discussions_by_blog.sql
 create mode 100644 mock_data/block_data/reblog_op/flow.txt
 create mode 100644 mock_data/block_data/reblog_op/mock_block_data_reblog.json

diff --git a/hive/db/schema.py b/hive/db/schema.py
index 275d3d65d..41f8f20c1 100644
--- a/hive/db/schema.py
+++ b/hive/db/schema.py
@@ -593,7 +593,6 @@ def setup(db):
       "condenser_api_post_ex_type.sql",
       "condenser_get_blog.sql",
       "condenser_get_content.sql",
-      "condenser_get_discussions_by_blog.sql",
       "condenser_tags.sql",
       "condenser_follows.sql",
       "hot_and_trends.sql",
diff --git a/hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql b/hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql
index def7c62c8..f605a5bc8 100644
--- a/hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql
+++ b/hive/db/sql_scripts/bridge_get_account_posts_by_blog.sql
@@ -4,19 +4,20 @@ CREATE OR REPLACE FUNCTION bridge_get_account_posts_by_blog(
   in _account VARCHAR,
   in _author VARCHAR,
   in _permlink VARCHAR,
-  in _limit INTEGER
+  in _limit INTEGER,
+  in _bridge_api BOOLEAN
 )
 RETURNS SETOF bridge_api_post
 AS
 $function$
 DECLARE
-  __post_id INTEGER := 0;
-  __account_id INTEGER := find_account_id( _account, True );
+  __post_id INTEGER;
+  __account_id INTEGER;
   __created_at TIMESTAMP;
 BEGIN
-
-  IF _permlink <> '' THEN
-    __post_id = find_comment_id( _author, _permlink, True );
+  __account_id = find_account_id( _account, True );
+  __post_id = find_comment_id( _author, _permlink, True );
+  IF __post_id <> 0 THEN
     SELECT hfc.created_at INTO __created_at
     FROM hive_feed_cache hfc
     WHERE hfc.account_id = __account_id AND hfc.post_id = __post_id;
@@ -65,16 +66,18 @@ BEGIN
     (
       SELECT hfc.post_id, hfc.created_at
       FROM hive_feed_cache hfc
-      WHERE hfc.account_id = __account_id AND (__post_id = 0 OR hfc.created_at <= __created_at)
-        AND NOT EXISTS (SELECT NULL FROM hive_posts hp
-                        WHERE hp.id = hfc.post_id AND hp.counter_deleted = 0 AND hp.depth = 0 AND hp.community_id IS NOT NULL
-                              AND NOT EXISTS (SELECT NULL FROM hive_reblogs hr WHERE hr.blogger_id = __account_id AND hr.post_id = hp.id)
+      WHERE hfc.account_id = __account_id AND ( __post_id = 0 OR hfc.created_at < __created_at OR ( hfc.created_at = __created_at AND hfc.post_id < __post_id ) )
+        AND ( NOT _bridge_api OR
+              NOT EXISTS (SELECT NULL FROM hive_posts hp1
+                          WHERE hp1.id = hfc.post_id AND hp1.counter_deleted = 0 AND hp1.depth = 0 AND hp1.community_id IS NOT NULL
+                          AND NOT EXISTS (SELECT NULL FROM hive_reblogs hr WHERE hr.blogger_id = __account_id AND hr.post_id = hp1.id)
+                         )
             )
-      ORDER BY created_at DESC
+      ORDER BY hfc.created_at DESC, hfc.post_id DESC
       LIMIT _limit
-    )T ON hp.id = T.post_id
-    ORDER BY T.created_at DESC
-    ;
+    ) blog ON hp.id = blog.post_id
+    ORDER BY blog.created_at DESC, blog.post_id DESC
+    LIMIT _limit;
 END
 $function$
 language plpgsql STABLE;
diff --git a/hive/db/sql_scripts/condenser_get_discussions_by_blog.sql b/hive/db/sql_scripts/condenser_get_discussions_by_blog.sql
deleted file mode 100644
index bcb514031..000000000
--- a/hive/db/sql_scripts/condenser_get_discussions_by_blog.sql
+++ /dev/null
@@ -1,141 +0,0 @@
-DROP TYPE IF EXISTS get_discussions_post CASCADE;
-CREATE TYPE get_discussions_post AS (
-  id INT,
-  community_id INT,
-  author VARCHAR(16),
-  permlink VARCHAR(255),
-  author_rep BIGINT,
-  title VARCHAR(512),
-  body TEXT,
-  category VARCHAR(255),
-  depth SMALLINT,
-  promoted DECIMAL(10, 3),
-  payout DECIMAL(10, 3),
-  payout_at TIMESTAMP,
-  pending_payout DECIMAL(10, 3),
-  is_paidout BOOLEAN,
-  children INT,
-  votes INT,
-  active_votes INT,
-  created_at TIMESTAMP,
-  updated_at TIMESTAMP,
-  rshares NUMERIC,
-  json TEXT,
-  is_hidden BOOLEAN,
-  is_grayed BOOLEAN,
-  total_votes BIGINT,
-  parent_author VARCHAR(16),
-  parent_permlink_or_category VARCHAR(255),
-  curator_payout_value VARCHAR(30),
-  root_author VARCHAR(16),
-  root_permlink VARCHAR(255),
-  max_accepted_payout VARCHAR(30),
-  percent_hbd INT,
-  allow_replies BOOLEAN,
-  allow_votes BOOLEAN,
-  allow_curation_rewards BOOLEAN,
-  beneficiaries JSON,
-  url TEXT,
-  root_title VARCHAR(512)
-);
-
-DROP FUNCTION IF EXISTS get_created_at_for_post;
-CREATE OR REPLACE FUNCTION get_created_at_for_post(
-  in _author hive_accounts.name%TYPE,
-  in _permlink hive_permlink_data.permlink%TYPE
-)
-RETURNS TIMESTAMP
-AS
-$function$
-DECLARE
-  __post_id INT;
-  __timestamp TIMESTAMP;
-BEGIN
-  __post_id = find_comment_id(_author, _permlink, False);
-  IF __post_id = 0 THEN
-    RETURN current_timestamp;
-  END IF;
-  SELECT INTO __timestamp
-    created_at
-  FROM
-    hive_posts hp
-  WHERE
-    hp.id = __post_id;
-  RETURN __timestamp;
-END
-$function$
-language 'plpgsql';
-
-DROP FUNCTION IF EXISTS get_discussions_by_blog;
-
-CREATE OR REPLACE FUNCTION get_discussions_by_blog(
-  in _tag hive_accounts.name%TYPE,
-  in _start_author hive_accounts.name%TYPE,
-  in _start_permlink hive_permlink_data.permlink%TYPE,
-  in _limit INT
-)
-RETURNS SETOF get_discussions_post
-AS
-$function$
-DECLARE
-  __created_at TIMESTAMP;
-BEGIN
-  __created_at = get_created_at_for_post(_start_author, _start_permlink);
-  RETURN QUERY SELECT
-        hp.id,
-        hp.community_id,
-        hp.author,
-        hp.permlink,
-        hp.author_rep,
-        hp.title,
-        hp.body,
-        hp.category,
-        hp.depth,
-        hp.promoted,
-        hp.payout,
-        hp.payout_at,
-        hp.pending_payout,
-        hp.is_paidout,
-        hp.children,
-        hp.votes,
-        hp.active_votes,
-        hp.created_at,
-        hp.updated_at,
-        hp.rshares,
-        hp.json,
-        hp.is_hidden,
-        hp.is_grayed,
-        hp.total_votes,
-        hp.parent_author,
-        hp.parent_permlink_or_category,
-        hp.curator_payout_value,
-        hp.root_author,
-        hp.root_permlink,
-        hp.max_accepted_payout,
-        hp.percent_hbd,
-        hp.allow_replies,
-        hp.allow_votes,
-        hp.allow_curation_rewards,
-        hp.beneficiaries,
-        hp.url,
-        hp.root_title
-    FROM hive_posts_view hp
-    INNER JOIN
-    (
-        SELECT
-            post_id
-        FROM
-            hive_feed_cache hfc
-        INNER JOIN hive_accounts hfc_ha ON hfc.account_id = hfc_ha.id
-        INNER JOIN hive_posts hfc_hp ON hfc.post_id = hfc_hp.id
-        WHERE
-            hfc_ha.name = _tag
-            AND hfc_hp.created_at <= __created_at
-        ORDER BY
-            hfc_hp.created_at DESC
-        LIMIT _limit
-    ) ds on ds.post_id = hp.id
-    ORDER BY hp.created_at DESC;
-END
-$function$
-language 'plpgsql';
\ No newline at end of file
diff --git a/hive/db/sql_scripts/db_upgrade.sh b/hive/db/sql_scripts/db_upgrade.sh
index 5ef694a59..c45d40913 100755
--- a/hive/db/sql_scripts/db_upgrade.sh
+++ b/hive/db/sql_scripts/db_upgrade.sh
@@ -44,7 +44,6 @@ for sql in postgres_handle_view_changes.sql \
           condenser_api_post_ex_type.sql \
           condenser_get_blog.sql \
           condenser_get_content.sql \
-          condenser_get_discussions_by_blog.sql \
           condenser_tags.sql \
           condenser_follows.sql \
           hot_and_trends.sql \
diff --git a/hive/server/bridge_api/methods.py b/hive/server/bridge_api/methods.py
index 4673b07f6..1250cb1d9 100644
--- a/hive/server/bridge_api/methods.py
+++ b/hive/server/bridge_api/methods.py
@@ -280,7 +280,7 @@ async def get_account_posts(context, sort:str, account:str, start_author:str='',
     sql = None
     account_posts = True # set when only posts (or reblogs) of given account are supposed to be in results
     if sort == 'blog':
-        sql = "SELECT * FROM bridge_get_account_posts_by_blog( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::INTEGER )"
+        sql = "SELECT * FROM bridge_get_account_posts_by_blog( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::INTEGER, True )"
     elif sort == 'feed':
         sql = "SELECT * FROM bridge_get_by_feed_with_reblog((:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::INTEGER)"
     elif sort == 'posts':
diff --git a/hive/server/condenser_api/methods.py b/hive/server/condenser_api/methods.py
index 7e5a6f719..44a0ce233 100644
--- a/hive/server/condenser_api/methods.py
+++ b/hive/server/condenser_api/methods.py
@@ -291,12 +291,10 @@ async def get_discussions_by_blog(context, tag: str = None, start_author: str =
     valid_permlink(start_permlink, allow_empty=True)
     valid_limit(limit, 100, 20)
 
-    sql = """
-        SELECT * FROM get_discussions_by_blog(:author, :start_author, :start_permlink, :limit)
-    """
+    sql = "SELECT * FROM bridge_get_account_posts_by_blog( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::INTEGER, False )"
 
     db = context['db']
-    result = await db.query_all(sql, author=tag, start_author=start_author, start_permlink=start_permlink, limit=limit)
+    result = await db.query_all(sql, account=tag, author=start_author, permlink=start_permlink, limit=limit)
     posts_by_id = []
 
     for row in result:
diff --git a/hive/server/tags_api/methods.py b/hive/server/tags_api/methods.py
index 9948fc855..9c85e9df4 100644
--- a/hive/server/tags_api/methods.py
+++ b/hive/server/tags_api/methods.py
@@ -3,7 +3,6 @@ from hive.server.common.helpers import (
     return_error_info,
     valid_account,
     valid_permlink)
-from hive.server.database_api.methods import find_votes_impl, VotesPresentation
 
 @return_error_info
 async def get_discussion(context, author: str, permlink: str, observer=None):
diff --git a/mock_data/block_data/follow_op/mock_block_data_follow.json b/mock_data/block_data/follow_op/mock_block_data_follow.json
index 2c419eb87..c018e6c81 100644
--- a/mock_data/block_data/follow_op/mock_block_data_follow.json
+++ b/mock_data/block_data/follow_op/mock_block_data_follow.json
@@ -1,7 +1,7 @@
 {
   "4999999": {
     "previous": "004c4b3e03ea2eac2494790786bfb9e41a8669d9",
-    "timestamp": "2016-09-15T19:47:24",
+    "timestamp": "2016-09-15T19:47:18",
     "witness": "",
     "transaction_merkle_root": "",
     "extensions": [],
@@ -425,7 +425,7 @@
   },
   "5000000": {
     "previous": "004c4b3fc6a8735b4ab5433d59f4526e4a042644",
-    "timestamp": "2016-09-15T19:47:24",
+    "timestamp": "2016-09-15T19:47:21",
     "witness": "initminer",
     "transaction_merkle_root": "",
     "extensions": [],
diff --git a/mock_data/block_data/reblog_op/flow.txt b/mock_data/block_data/reblog_op/flow.txt
new file mode 100644
index 000000000..16a6c1d3a
--- /dev/null
+++ b/mock_data/block_data/reblog_op/flow.txt
@@ -0,0 +1,4 @@
+***block 4999999***
+custom_json_operation("[\"reblog\",{\"account\":\"funny\",\"author\":\"steemit\",\"permlink\":\"firstpost\"}]") - very old post
+custom_json_operation("[\"reblog\",{\"account\":\"funny\",\"author\":\"steak\",\"permlink\":\"streak-test\"}]") - deleted post (should not be reblogged)
+custom_json_operation("[\"reblog\",{\"account\":\"funny\",\"author\":\"dollarvigilante\",\"permlink\":\"another-billionaire-warns-of-catastrophic-depths-not-seen-in-5-000-years-and-emphasizes-gold\"}]") - fresh post
\ No newline at end of file
diff --git a/mock_data/block_data/reblog_op/mock_block_data_reblog.json b/mock_data/block_data/reblog_op/mock_block_data_reblog.json
new file mode 100644
index 000000000..27f43c34d
--- /dev/null
+++ b/mock_data/block_data/reblog_op/mock_block_data_reblog.json
@@ -0,0 +1,271 @@
+{
+  "4999999": {
+    "previous": "004c4b3e03ea2eac2494790786bfb9e41a8669d9",
+    "timestamp": "2016-09-15T19:47:18",
+    "witness": "",
+    "transaction_merkle_root": "",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b3fc6a8735b4ab5433d59f4526e4a042644",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000000": {
+    "previous": "004c4b3fc6a8735b4ab5433d59f4526e4a042644",
+    "timestamp": "2016-09-15T19:47:21",
+    "witness": "initminer",
+    "transaction_merkle_root": "",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [
+      {
+        "ref_block_num": 100001,
+        "ref_block_prefix": 1,
+        "expiration": "2020-03-23T12:17:00",
+        "operations": [
+          {
+            "type": "custom_json_operation",
+            "value": {
+              "required_auths": [],
+              "required_posting_auths": [
+                "funny"
+              ],
+              "id": "follow",
+              "json": "[\"reblog\",{\"account\":\"funny\",\"author\":\"steemit\",\"permlink\":\"firstpost\"}]"
+            }
+          },
+          {
+            "type": "custom_json_operation",
+            "value": {
+              "required_auths": [],
+              "required_posting_auths": [
+                "funny"
+              ],
+              "id": "follow",
+              "json": "[\"reblog\",{\"account\":\"funny\",\"author\":\"steak\",\"permlink\":\"streak-test\"}]"
+            }
+          },
+          {
+            "type": "custom_json_operation",
+            "value": {
+              "required_auths": [],
+              "required_posting_auths": [
+                "funny"
+              ],
+              "id": "follow",
+              "json": "[\"reblog\",{\"account\":\"funny\",\"author\":\"dollarvigilante\",\"permlink\":\"another-billionaire-warns-of-catastrophic-depths-not-seen-in-5-000-years-and-emphasizes-gold\"}]"
+            }
+          }
+        ]
+      }
+    ],
+    "block_id": "004c4b40245ffb07380a393fb2b3d841b76cdaec",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000001": {
+    "previous": "004c4b40245ffb07380a393fb2b3d841b76cdaec",
+    "timestamp": "2016-09-15T19:47:24",
+    "witness": "initminer",
+    "transaction_merkle_root": "",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4100000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000002": {
+    "previous": "004c4b4100000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:27",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4200000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000003": {
+    "previous": "004c4b4200000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:30",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4300000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000004": {
+    "previous": "004c4b4300000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:33",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4400000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000005": {
+    "previous": "004c4b4400000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:36",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4500000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000006": {
+    "previous": "004c4b4500000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:39",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4600000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000007": {
+    "previous": "004c4b4600000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:42",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4700000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000008": {
+    "previous": "004c4b4700000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:45",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4800000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000009": {
+    "previous": "004c4b4800000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:48",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4900000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000010": {
+    "previous": "004c4b4900000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:51",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4a00000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000011": {
+    "previous": "004c4b4a00000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:54",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4b00000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000012": {
+    "previous": "004c4b4b00000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:47:57",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4c00000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000013": {
+    "previous": "004c4b4c00000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:48:00",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4d00000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000014": {
+    "previous": "004c4b4d00000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:48:03",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4e00000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000015": {
+    "previous": "004c4b4e00000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:48:06",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b4f00000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000016": {
+    "previous": "004c4b4f00000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:48:09",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b5000000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  },
+  "5000017": {
+    "previous": "004c4b5000000000000000000000000000000000",
+    "timestamp": "2016-09-15T19:48:12",
+    "witness": "initminer",
+    "transaction_merkle_root": "0000000000000000000000000000000000000000",
+    "extensions": [],
+    "witness_signature": "",
+    "transactions": [],
+    "block_id": "004c4b5100000000000000000000000000000000",
+    "signing_key": "",
+    "transaction_ids": []
+  }
+}
\ No newline at end of file
diff --git a/scripts/ci/hive-sync.sh b/scripts/ci/hive-sync.sh
index 7b3373a2d..e19bb585b 100755
--- a/scripts/ci/hive-sync.sh
+++ b/scripts/ci/hive-sync.sh
@@ -28,7 +28,7 @@ EOF
         --steemd-url "${RUNNER_HIVED_URL}" \
         --prometheus-port 11011 \
         --database-url "${DATABASE_URL}" \
-        --mock-block-data-path mock_data/block_data/follow_op/mock_block_data_follow.json \
+        --mock-block-data-path mock_data/block_data/follow_op/mock_block_data_follow.json mock_data/block_data/reblog_op/mock_block_data_reblog.json \
         2>&1 | tee -i hivemind-sync.log
 
 }
diff --git a/scripts/ci_sync.sh b/scripts/ci_sync.sh
index 9b71e585d..652a1df5f 100755
--- a/scripts/ci_sync.sh
+++ b/scripts/ci_sync.sh
@@ -58,5 +58,5 @@ fi
 
 echo Attempting to starting hive sync using hived node: $HIVEMIND_SOURCE_HIVED_URL . Max sync block is: $HIVEMIND_MAX_BLOCK
 echo Attempting to access database $DB_URL
-./$HIVE_NAME sync --pid-file hive_sync.pid --test-max-block=$HIVEMIND_MAX_BLOCK --exit-after-sync --test-profile=False --steemd-url "$HIVEMIND_SOURCE_HIVED_URL" --prometheus-port 11011 --database-url $DB_URL --mock-block-data-path mock_data/block_data/follow_op/mock_block_data_follow.json 2>&1 | tee -i hivemind-sync.log
+./$HIVE_NAME sync --pid-file hive_sync.pid --test-max-block=$HIVEMIND_MAX_BLOCK --exit-after-sync --test-profile=False --steemd-url "$HIVEMIND_SOURCE_HIVED_URL" --prometheus-port 11011 --database-url $DB_URL --mock-block-data-path mock_data/block_data/follow_op/mock_block_data_follow.json mock_data/block_data/reblog_op/mock_block_data_reblog.json 2>&1 | tee -i hivemind-sync.log
 rm hive_sync.pid
diff --git a/tests/tests_api b/tests/tests_api
index e9e2687e1..69d84d219 160000
--- a/tests/tests_api
+++ b/tests/tests_api
@@ -1 +1 @@
-Subproject commit e9e2687e1cd8bc9778f50cdecc3825eac6466d5f
+Subproject commit 69d84d2190462513f45eaffcfe6000466b22ccba
-- 
GitLab