get_content returns cache error when post is deleted

When issuing a get_content() call against a deleted post or comment, hivemind returns a "post was not found in cache" error. It should either return an explicit error message or an empty post as hived did before.

This is because of the view hive_posts_view which filters out deleted items in its WHERE clause.

  • How to reproduce

{"jsonrpc":"2.0", "method":"condenser_api.get_content", "params":["stortebeker", "re-deflacion-qhxrya"], "id":1 }

actual result:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32602,
        "message": "Invalid parameters",
        "data": "post was not found in cache"
    },
    "id": 1
}

expected result:

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "abs_rshares": 0,
        "active": "1970-01-01T00:00:00",
        "active_votes": [],
        "allow_curation_rewards": false,
        "allow_replies": false,
        "allow_votes": false,
        "author": "",
        "author_reputation": 0,
        "author_rewards": 0,
        "beneficiaries": [],
        "body": "",
        "body_length": 0,
        "cashout_time": "1970-01-01T00:00:00",
        "category": "",
        "children": 0,
        "children_abs_rshares": 0,
        "created": "1970-01-01T00:00:00",
        "curator_payout_value": "0.000 HBD",
        "depth": 0,
        "id": 0,
        "json_metadata": "",
        "last_payout": "1970-01-01T00:00:00",
        "last_update": "1970-01-01T00:00:00",
        "max_accepted_payout": "0.000 HBD",
        "max_cashout_time": "1970-01-01T00:00:00",
        "net_rshares": 0,
        "net_votes": 0,
        "parent_author": "",
        "parent_permlink": "",
        "pending_payout_value": "0.000 HBD",
        "percent_hbd": 0,
        "permlink": "",
        "promoted": "0.000 HBD",
        "reblogged_by": [],
        "replies": [],
        "reward_weight": 0,
        "root_author": "",
        "root_permlink": "",
        "root_title": "",
        "title": "",
        "total_payout_value": "0.000 HBD",
        "total_pending_payout_value": "0.000 HBD",
        "total_vote_weight": 0,
        "url": "",
        "vote_rshares": 0
    }
}
  • Proposed solution

As many other condenser API rely on hive_posts_view and removing the where clause will have a lot of side effects, create a separate query for get_content()

Edited by arcange