The stamp after buying cannot be distinguished from an expired stamp
Context
Bee 1.6.2, macOS
Summary
It is not possible to distinguish a stamp that you just bought from an expired stamp because all their relevant properties are the same.
There are certain properties of a stamp to tell the state of it. usable, exists and batchTTL are such properties. However these properties are the same for a stamp you just bought and a stamp that is expired, therefore it's impossible to tell the difference between them. This may cause problems in applications because it is not trivial to filter out expired postage stamps, but most of the time the users are not interested in those. The workaround for now for applications is to keep track of the id of a recently bought postage stamp and not filter out those as expired, but this makes the API more difficult to use than necessary. Also it can lead to subtle bugs.
It would be better to distinguish between these use case. This could be possibly done either by adding an extra field to the postage stamp (e.g. expired), which would only be true in the case of the stamp were expired.
Previously the expired stamp just disappeared from the list of stamps, but this behaviour has changed at some point. That behaviour would also solve this issue, but I am not sure why (and when) this was changed and what would break if this would be reverted.
More detailed explanation:
Immediately after buying a stamp, it looks like this (only keeping the relevant properties):
"usable": false,
"exists": false,
"batchTTL": -1
After ~30 secs, it looks like this:
"usable": false,
"exists": true,
"batchTTL": 1125
After a minute or two:
"usable": true,
"exists": true,
"batchTTL": 1075
After expiry (this is the same as right after buying):
"usable": false,
"exists": false,
"batchTTL": -1