nano-node
nano-node copied to clipboard
Websocket confirmation topic : Add source_account on receive blocks / open blocks
In response to issue 3523 ( https://github.com/nanocurrency/nano-node/issues/3523 ) I added the source_account into the websocket confirmation topic.
The source_account is added for each block type. It follows the same logic as "block_info" rpc call. For "open" and "receive" blocks, we show the nano_address corresponding to the sender account. Else (for "send", "change" and "epoch") we show "0"
The concept for this PR makes sense and I agree it'd be useful to implementations.
The websocket.confirmation_options test fails which needs to be addressed. This seems like a possible race condition in the test that can be fixed.
I think this information is more generally applicable, specifically it's useful in both RPCs and web socket callbacks. Additionally, it seems useful to have a single data item that identifies the counterparty, rather than using two depending if it's a send or a receive.
I've made two changes I think will make this most useful. These changes would deprecate "link_as_account" which is only a translation of the link field to an account number and only works for send blocks, and adds "linked_account" which is the counterparty for any balance-changing transaction, omitted if it is not a balance changing transaction.
https://github.com/nanocurrency/nano-node/tree/websocket_confirmation_source_account
After discussion, we need to further define the structure for this and will do so soon, but the PR will be merged for a version after V23.0