better mempool queueing

This commit is contained in:
Ethan Buchman
2015-09-25 12:55:59 -04:00
parent beff6216fe
commit 12566f51af
7 changed files with 182 additions and 44 deletions

View File

@ -31,7 +31,7 @@ func DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
peerRoundStates := []string{}
for _, peer := range p2pSwitch.Peers().List() {
// TODO: clean this up?
peerState := peer.Data.Get(cm.PeerStateKey).(*cm.PeerState)
peerState := peer.Data.Get(types.PeerStateKey).(*cm.PeerState)
peerRoundState := peerState.GetRoundState()
peerRoundStateStr := peer.Key + ":" + string(wire.JSONBytes(peerRoundState))
peerRoundStates = append(peerRoundStates, peerRoundStateStr)

View File

@ -30,5 +30,6 @@ func BroadcastTx(tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
}
func ListUnconfirmedTxs() (*ctypes.ResultListUnconfirmedTxs, error) {
return &ctypes.ResultListUnconfirmedTxs{mempoolReactor.Mempool.GetProposalTxs()}, nil
txs := mempoolReactor.Mempool.GetProposalTxs()
return &ctypes.ResultListUnconfirmedTxs{len(txs), txs}, nil
}

View File

@ -98,6 +98,7 @@ type Receipt struct {
}
type ResultListUnconfirmedTxs struct {
N int `json:"n_txs"`
Txs []types.Tx `json:"txs"`
}