Is the 'receive' subtype a valid alternative to 'open'?

I'm irritated about the open subtype. The documentation on the process RPC states that the subtype can be one of send, receive, open, change and epoch.

For the block_info RPC, however, the documentation states that only send , receive , change and epoch are possible. This seems to match the implementation: The first block of an account always has the subtype receive according to this RPC.

When submitting the first block of an account through the process RPC, I can see that either subtype receive or open are accepted - it seems to make no difference at all. This makes me wonder: Should I even bother to differentiate receive and open in my wallet (atto)? I had forgotten to think about this when writing it initially, but never noticed, because the subtype receive worked anyway...

That subtype entry on the process RPC may be better thought of as your intention for the block you are submitting. If your stated intention is different than what the block contents you send contain then you get errors. The main issue, as noted in the docs is around accidental send instead of receive, which can occur when not taking proper care and indicating your intentions.

Although I don't know the exact logic in the RPC validation at this point, what I believe you may get with the open subtype on the process RPC is an initial validation on the previous field, which must be 0 for the open block. This failure response may come earlier than if you attempted a receive with an improper previous value, although the advantages of this earlier failure may be only slight. The fact that these are both called subtype is a bit confusing. We can review this as part of our RPC changes coming up, I will not there: RPC v3 · Issue #3483 · nanocurrency/nano-node · GitHub

1 Like

Thank you for your reply! I take it as a reassurance, that using the subtype receive for the first block of an account will cause no huge problems. If the node takes a little longer to notice an invalid first block and responds a little slower, that is no big problem for me.

I will thus keep using receive for all blocks where funds are received - no matter if they are the first or not. This will keep the code of my wallet simpler.