mempool TX notifications + missing functionality in other RPCs
The initial batch of blockchain.address.{get_balance,get_history,...} RPCs are lacking the ability to report things happening in unconfirmed TXs. Need to monitor the mempool tables written by scribe? Or contact lbcd?
This is critical to getting tests working. Lbry-sdk needs to receive notifications about mempool TXs and retrieve TX details. See #77.
It appears (Python) herald monitors the MempoolTX table contents (prefix d).
Sending to @jeffreypicard who has volunteered to work on this.
(go) Herald needs to monitor MempoolTX table and/or HashXMempoolStatus to see when new txs appear or status changes happen. When status of a hashX changes, notification (hashXNotification) should be delivered on the NotifierChan. Client should respond to the notification by performing address.get_history and transaction.get_batch. Herald should respond with tx hashes and details that include mempool transactions. A quirk of mempool transactions is they report with height=-1 (and some other details are missing). Later when a transaction migrates from mempool to the blockchain, the height and other details become known.
def get_mempool_height(self, tx_hash: bytes) -> int:
# Height Progression
# -2: not broadcast
# -1: in mempool but has unconfirmed inputs
# 0: in mempool and all inputs confirmed
# +num: confirmed in a specific block (height)