electrs icon indicating copy to clipboard operation
electrs copied to clipboard

Feature: add blockchain.outpoint Electrum 1.5 methods in p2p branch

Open Pantamis opened this issue 3 years ago • 6 comments

The p2p branch uses a db compatible with version 1.5 of Electrum protocol, one of the new features of 1.5 is the outpoint subscription methods to get the spending transaction of an tx output.

I forked btc-rpc-explorer to add a link to spending transaction of an output to the explorer display using this method, like what blockstream.info explorer does. I would like to test it.

It seems that blockchain.outpoint.subscribe was already implemented in outpoint-RPC branch back in nov 2020 but didn't made it to p2p. Could you "merge" it with p2p ? (I guess that some glue code may be needed)

Do we need the unsubscribe method in current electrs implementation to properly avoid flood of subscriptions/notifications ?

Thanks !

Pantamis avatar Jul 22 '21 23:07 Pantamis

Sounds good, but I prefer adding it when https://github.com/spesmilo/electrumx/pull/90 is officially merged.

romanz avatar Jul 23 '21 05:07 romanz

Ok, I understand.

I never coded in rust but is it possible to simply cherry pick the content of the last commit in outpoint-rpc branch and apply it to current p2p one to make it work ?

The files are not the same but taking the diff of last commit of outpoint branch of rpc.rs and apply it on electrum.rs could make it works, didn't it ?

I am just searching a quick way for me to try ^^' (if I have something working I will submit a PR you can merge once Electrum 1.5 is merged too)

Pantamis avatar Jul 23 '21 06:07 Pantamis

Please note that the outpoint-rpc branch doesn't implement the notification mechanism specified here: https://github.com/spesmilo/electrumx/pull/90/files#diff-ffa7e37c618564f8c58d9072b5ef234e6e9b2cdf1d71d16be7dc356146cb475fR648-R655 It was a "WIP" implementation that I put on hold, waiting for the official Electrum 1.5 protocol release.

romanz avatar Jul 23 '21 08:07 romanz

Ok, so if I understand well, it will just return the "current" status of the outpoint, that's why you don't need to unsubscribe to notifications.

Pantamis avatar Jul 23 '21 10:07 Pantamis

Could you take a look at what I tried in #446 ?

I couldn't test it properly for now because I can't increase verbosity with config file and I don't know how to make a request locally to test the method.

Thanks for your help !

Pantamis avatar Jul 24 '21 11:07 Pantamis

Many thanks for the contribution! I have pushed a bit different implementation at #454, including the subscription and notification mechanism.

romanz avatar Aug 13 '21 18:08 romanz