Browse Source

list_unconfirmed_txs RPC call

pull/67/head
Jae Kwon 10 years ago
parent
commit
115e57a1d5
3 changed files with 9 additions and 4 deletions
  1. +4
    -3
      rpc/core/mempool.go
  2. +1
    -0
      rpc/core/routes.go
  3. +4
    -1
      rpc/core/types/responses.go

+ 4
- 3
rpc/core/mempool.go 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
}

+ 1
- 0
rpc/core/routes.go 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"}),


+ 4
- 1
rpc/core/types/responses.go 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


Loading…
Cancel
Save