[NKP-0007] Include subscribers in txn pool in getsubscribers RPC response

Currently get subscribers api returns subscribers of a (topic, bucket) in block history. It takes around one block interval (~20s) for new subscribers to be included in the response. This is quite slow for many use cases.

Since we impose strict txn check, it’s almost guaranteed that txn in txn pool will eventually be included in block. Thus it makes sense to include subscribers in txn pool together with subscribers in block. Doing so will make subscribe much faster without compromising correctness.

To distinguish between subscribers in block and subscribers in tx pool, I’m suggesting to make response into this format:

    subscribers: {subscriber1:metadata1, subscriber2:metadata2, ...}
    subscribersInTxPool: {subscriber3:metadata3, subscriber4:metadata4, ...}

This will break the existing json rpc response, but we can handle it in sdk to make it compatible to both response scheme.

@insider @JohnSmith @lynn

1 Like

I am ok with that. Tell me when it is implemented on the node level so I can add it to my client sdk

you can track implementation here: https://github.com/nknorg/nkn/pull/609