示例#1
0
        public IActionResult GetUnknownTransactions([FromBody] ViewModel <List <string> > viewModel) //data are list of tx hashes, returns list of RLP serialized txs
        {
            lock (GateKeeper.TransactionPoolLock)
            {
                lock (GateKeeper.BalanceLedgerLock)
                {
                    if (viewModel != null && viewModel.Data != null)
                    {
                        var unknownTxs = _transactionPool.GetUnknown(viewModel.Data);

                        var transactions = new List <string>();

                        foreach (var tx in unknownTxs)
                        {
                            transactions.Add(HexConverter.ToPrefixString(tx.Serialize()));
                        }

                        return(Ok(transactions));
                    }
                    else
                    {
                        return(BadRequest());
                    }
                }
            }
        }