Skip to content

Echo broadcast transactions to subscribed Electrum clients. - #928

Open
eynhaender wants to merge 1 commit into
libbitcoin:masterfrom
eynhaender:fix/broadcast_feedback
Open

eynhaender wants to merge 1 commit into
libbitcoin:masterfrom
eynhaender:fix/broadcast_feedback

Conversation

@eynhaender

Copy link
Copy Markdown
Contributor

There is no tx pool, so a client's own broadcast tx (or another client's) was never chased until archived, leaving scripthash subscribers with no signal beyond a one-shot poll they had to know to make.

Subscribe each Electrum channel to the transaction broadcast, mirroring the tx/block protocols, and on receipt check it against that channel's active scripthash subscriptions. On a match, recompute status - folding in a channel-strand snapshot of not-yet-archived retained transactions, since retained() is channel-strand protected and this runs on the notification strand - and push the same blockchain.scripthash.subscribe notification real confirmations already use.

Tradeoff: the retained() snapshot (bounded to 16 entries) is copied on every relayed broadcast a channel has active subscriptions for, before it is known whether that specific transaction is relevant, because touches() can only be checked against address_subscriptions_ on the notification strand. Cheap given the bound, but a real cost on every broadcast, not just matching ones.

There is no tx pool, so a client's own broadcast tx (or another client's)
was never chased until archived, leaving scripthash subscribers with no
signal beyond a one-shot poll they had to know to make.

Subscribe each Electrum channel to the transaction broadcast, mirroring the
tx/block protocols, and on receipt check it against that channel's active
scripthash subscriptions. On a match, recompute status - folding in a
channel-strand snapshot of not-yet-archived retained transactions, since
retained() is channel-strand protected and this runs on the notification
strand - and push the same blockchain.scripthash.subscribe notification
real confirmations already use.

Tradeoff: the retained() snapshot (bounded to 16 entries) is copied on every
relayed broadcast a channel has active subscriptions for, before it is known
whether that specific transaction is relevant, because touches() can only be
checked against address_subscriptions_ on the notification strand. Cheap
given the bound, but a real cost on every broadcast, not just matching ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant