diff --git a/rpc/core/mempool.go b/rpc/core/mempool.go index 6d5d98926..4fa935603 100644 --- a/rpc/core/mempool.go +++ b/rpc/core/mempool.go @@ -30,6 +30,7 @@ func BroadcastTx(tx types.Tx) (*ctypes.ResponseBroadcastTx, error) { return &ctypes.ResponseBroadcastTx{ctypes.Receipt{txHash, createsContract, contractAddr}}, nil } -/* -curl -H 'content-type: text/plain;' http://127.0.0.1:8888/submit_tx?tx=... -*/ +func ListUnconfirmedTxs() (*ctypes.ResponseListUnconfirmedTxs, error) { + txs := mempoolReactor.Mempool.GetProposalTxs() + return &ctypes.ResponseListUnconfirmedTxs{txs}, nil +} diff --git a/rpc/core/routes.go b/rpc/core/routes.go index 17f196ab0..6ba49c49e 100644 --- a/rpc/core/routes.go +++ b/rpc/core/routes.go @@ -17,6 +17,7 @@ var Routes = map[string]*rpc.RPCFunc{ "dump_consensus_state": rpc.NewRPCFunc(DumpConsensusState, []string{}), "dump_storage": rpc.NewRPCFunc(DumpStorage, []string{"address"}), "broadcast_tx": rpc.NewRPCFunc(BroadcastTx, []string{"tx"}), + "list_unconfirmed_txs": rpc.NewRPCFunc(ListUnconfirmedTxs, []string{}), "list_accounts": rpc.NewRPCFunc(ListAccounts, []string{}), "unsafe/gen_priv_account": rpc.NewRPCFunc(GenPrivAccount, []string{}), "unsafe/sign_tx": rpc.NewRPCFunc(SignTx, []string{"tx", "privAccounts"}), diff --git a/rpc/core/types/responses.go b/rpc/core/types/responses.go index 79d42e039..0f3cdd496 100644 --- a/rpc/core/types/responses.go +++ b/rpc/core/types/responses.go @@ -50,11 +50,14 @@ type ResponseGetBlock struct { Block *types.Block } -// curl -H 'content-type: text/plain;' http://127.0.0.1:8888/submit_tx?tx=... type ResponseBroadcastTx struct { Receipt Receipt } +type ResponseListUnconfirmedTxs struct { + Txs []types.Tx +} + type Receipt struct { TxHash []byte CreatesContract uint8