config: cswal_light, mempool_broadcast, mempool_reap

This commit is contained in:
Ethan Buchman
2016-03-03 06:31:59 +00:00
parent 69d906f7dd
commit 3891e4d66d
12 changed files with 51 additions and 7 deletions
+5
View File
@@ -39,3 +39,8 @@ func UnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error) {
txs := mempoolReactor.Mempool.Reap()
return &ctypes.ResultUnconfirmedTxs{len(txs), txs}, nil
}
func TestStartMempool() (*ctypes.ResultTestStartMempool, error) {
config.Set("mempool_reap", true)
return &ctypes.ResultTestStartMempool{}, nil
}
+9
View File
@@ -20,6 +20,7 @@ var Routes = map[string]*rpc.RPCFunc{
"broadcast_tx_sync": rpc.NewRPCFunc(BroadcastTxSyncResult, "tx"),
"broadcast_tx_async": rpc.NewRPCFunc(BroadcastTxAsyncResult, "tx"),
"unconfirmed_txs": rpc.NewRPCFunc(UnconfirmedTxsResult, ""),
"test_start_mempool": rpc.NewRPCFunc(TestStartMempoolResult, ""), // move to test server ?
// subscribe/unsubscribe are reserved for websocket events.
}
@@ -126,3 +127,11 @@ func BroadcastTxAsyncResult(tx []byte) (ctypes.TMResult, error) {
return r, nil
}
}
func TestStartMempoolResult() (ctypes.TMResult, error) {
if r, err := TestStartMempool(); err != nil {
return nil, err
} else {
return r, nil
}
}
+6
View File
@@ -68,6 +68,8 @@ type ResultUnconfirmedTxs struct {
Txs []types.Tx `json:"txs"`
}
type ResultTestStartMempool struct{}
type ResultSubscribe struct {
}
@@ -105,6 +107,9 @@ const (
ResultTypeSubscribe = byte(0x80)
ResultTypeUnsubscribe = byte(0x81)
ResultTypeEvent = byte(0x82)
// 0xa bytes for testing
ResultTypeTestStartMempool = byte(0xa0)
)
type TMResult interface {
@@ -127,4 +132,5 @@ var _ = wire.RegisterInterface(
wire.ConcreteType{&ResultSubscribe{}, ResultTypeSubscribe},
wire.ConcreteType{&ResultUnsubscribe{}, ResultTypeUnsubscribe},
wire.ConcreteType{&ResultEvent{}, ResultTypeEvent},
wire.ConcreteType{&ResultTestStartMempool{}, ResultTypeTestStartMempool},
)