Post
Topic
Board Announcements (Altcoins)
Re: NXT :: descendant of Bitcoin - Updated Information
by
Jean-Luc
on 05/02/2014, 09:32:36 UTC
Btw, what do u think of the approach when dumb actions, like an attempt to cancel a non-existent bid order, r processed without sanity checks? The fee is paid, transaction is added to the block but the state is not changed.
I don't like the idea, at least in this case it is very simple to enforce such a check, in Transaction.Type.ColoredCoins.ASK_ORDER_CANCELLATION just add:

boolean validateAttachment(Transaction transaction) {
                    Attachment.ColoredCoinsAskOrderCancellation attachment = (Attachment.ColoredCoinsAskOrderCancellation)transaction.attachment;
                    if (Order.Ask.getAskOrder(attachment.getOrderId()) == null) {
                        return false;
                    }
                    return Genesis.CREATOR_ID.equals(transaction.recipientId) && transaction.amount == 0;
}