Esempio n. 1
0
        private void Mempool_OnTransactionFailed(Hash hash)
        {
            if (!running)
            {
                return;
            }

            var status = mempool.GetTransactionStatus(hash, out string reason);

            logger.Warning($"Rejected transaction {hash} => " + reason);
        }
Esempio n. 2
0
        public IAPIResult GetTransaction([APIParameter("Hash of transaction", "EE2CC7BA3FFC4EE7B4030DDFE9CB7B643A0199A1873956759533BB3D25D95322")] string hashText)
        {
            Hash hash;

            if (!Hash.TryParse(hashText, out hash))
            {
                return(new ErrorResult {
                    error = "Invalid hash"
                });
            }

            var tx = Nexus.FindTransactionByHash(hash);

            if (tx == null)
            {
                if (Mempool != null)
                {
                    var status = Mempool.GetTransactionStatus(hash, out string reason);
                    switch (status)
                    {
                    case MempoolTransactionStatus.Pending:
                        return(new ErrorResult {
                            error = "pending"
                        });

                    case MempoolTransactionStatus.Rejected:
                        return(new ErrorResult {
                            error = "rejected: " + reason
                        });
                    }
                }

                return(new ErrorResult {
                    error = "Transaction not found"
                });
            }

            return(FillTransaction(tx));
        }
Esempio n. 3
0
        private void Mempool_OnTransactionFailed(Transaction tx)
        {
            var status = mempool.GetTransactionStatus(tx.Hash, out string reason);

            logger.Warning($"Rejected transaction {tx.Hash} => " + reason);
        }