herald.go icon indicating copy to clipboard operation
herald.go copied to clipboard

mempool TX notifications + missing functionality in other RPCs

Open moodyjon opened this issue 3 years ago • 3 comments

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?

moodyjon avatar Oct 20 '22 13:10 moodyjon

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).

moodyjon avatar Dec 07 '22 13:12 moodyjon

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.

moodyjon avatar Dec 14 '22 15:12 moodyjon


    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)

moodyjon avatar Dec 14 '22 21:12 moodyjon