Skip to content

Conversation

@promag
Copy link
Contributor

@promag promag commented Jan 6, 2020

This is an alternative to -walletnotify which has the advantage of publishing the wallet name. This is essential in a multi-wallet setup.

I'm submitting to seek concept ACK and/or suggestions.

Currently the published message contains the wallet name (lengh + bytes) followed by 32 bytes of the wallet transaction. Also considering to include the change (added, updated, removed) but I'm open for suggestions.

Currently working on extending the test test/functional/interface_zmq.py as well as contrib/zmq/zmq_sub.py and relevant documentation.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 6, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #17261 (Make ScriptPubKeyMan an actual interface and the wallet to have multiple by achow101)
  • #16528 ([WIP] Native Descriptor Wallets (take 2) by achow101)
  • #13686 (ZMQ: Small cleanups in the ZMQ code by domob1812)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@promag promag force-pushed the 2019-01-zmqpubwallettx branch from 0839a12 to 52a5dd8 Compare January 6, 2020 12:16
uint32_t name_size = htonl(wallet->GetName().size());
oss.write((const char*)&name_size, sizeof(name_size));
oss << wallet->GetName();
oss.write((const char*) hash.begin(), 32);
Copy link
Contributor

@0xB10C 0xB10C Jan 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept alternative: ZMQ supports mulitpart messages. Might make sense to split the wallet name, hash and reason over multiple frames rather than creating a custom protocol for serialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can't do that unless the payload goes after the sequence number - I mean if we want to be consistent with existing messages.

Copy link
Contributor

@0xB10C 0xB10C Jan 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, that it would not be super consistent with the existing messages. However, there was just never the need for more that one payload.

For discussion:
Currently we send a fixed 3 part multipart message.

| topic | payload | sequence number |

I had an extension similar the following in mind when I read you PR description.

| topic | wallet name | hash | (reason/change) | sequence number |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, sequence is already a different part. Will update accordingly.

@bitcoin bitcoin deleted a comment from Binh0103 Jan 9, 2020
@luke-jr
Copy link
Member

luke-jr commented Jan 26, 2020

See also #10554. This older PR is apparently both used in production by its author, @somdoron, as well as included in Bitcoin Knots. For that reason, it would be ideal to use an interface compatible with it if reasonably possible - I think simply putting the hash as the first item might work; maybe multipart too? (not sure)

Note it's called -zmqpubhashwallettx there (and a raw variant provided). I'm not sure if the raw variant is as easily extended to include a wallet name - that might require the multipart stuff.

@luke-jr
Copy link
Member

luke-jr commented Jan 26, 2020

Also note I have a recent (0.19) rebase of the old PR here: 8db19e8

@promag
Copy link
Contributor Author

promag commented Jan 26, 2020

@luke-jr thanks for pointing that, I was under the impression there was something similar. I'll look closely at 8db19e8.

@promag promag closed this Nov 1, 2020
@promag promag deleted the 2019-01-zmqpubwallettx branch November 1, 2020 21:48
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants