Пример #1
0
        public virtual bool ValidateTransaction(TransactionBlock previousBlock)
        {
            if (Balances.Any(x => x.Value < 0))
            {
                return(false);
            }

            var trs = GetBalanceChanges(previousBlock);

            if (this is TokenGenesisBlock)
            {
                // lyra down, other up
                if (trs.Changes.Count == 0 || trs.Changes[LyraGlobal.OFFICIALTICKERCODE] >= 0)
                {
                    return(false);
                }
            }
            else
            {
                if (BlockType == BlockTypes.ReceiveAsFee)
                {
                    if (trs.Changes.Count != 0)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (trs.Changes.Count == 0 || trs.Changes.Any(a => a.Value <= 0))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }