How do unused subaddresses between used subaddresses can persist after restoring an account?

I created 3 subaddresses and only used subaddress 1 and subaddress 3, but when restoring the account from the seed, I noted that unused subaddress 2 was also there. Then I repeated the same with even more subaddresses and those also got restored together with the used ones. They only didn't get restored if there was not a used subaddress after the unused ones.

How is this possible? Do unused subaddresses get recorded in the blockchain in the transaction of the used subaddress that gets created after them, if all those are created in the same wallet?

And if they are, doesn't this would be an spam vulnerability? Since you could create n subaddresses and record them in the blockchain for free? Or is there an associated cost to the transaction if you can record all of these subaddresses?

Edit: After toying around a little bit more, it seems like what happens is that the subaddresses will always be generated in the same order, so subaddress 2 will always be subaddress 2 and the monero-wallet-cli simply shows you all the subaddresses up to the last one that was generated AND used.

submitted by /u/bootowaxgokjs
[link] [comments]

Leave a Reply

Your email address will not be published. Required fields are marked *