list_unconfirmed_txs RPC call

This commit is contained in:
Jae Kwon 2015-04-25 13:26:36 -07:00
parent 8aaa918143
commit 115e57a1d5
3 changed files with 9 additions and 4 deletions

View File

@ -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
}

View File

@ -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"}),

View File

@ -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