2015-03-26 21:30:42 -07:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2015-04-07 11:44:25 -07:00
|
|
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
2015-04-01 17:30:16 -07:00
|
|
|
"github.com/tendermint/tendermint/types"
|
2015-03-26 21:30:42 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Note: tx must be signed
|
2015-08-10 20:38:45 -07:00
|
|
|
func BroadcastTx(tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
|
2015-03-26 21:30:42 -07:00
|
|
|
err := mempoolReactor.BroadcastTx(tx)
|
|
|
|
if err != nil {
|
2015-03-28 23:10:05 -07:00
|
|
|
return nil, fmt.Errorf("Error broadcasting transaction: %v", err)
|
2015-03-26 21:30:42 -07:00
|
|
|
}
|
2015-11-01 11:34:08 -08:00
|
|
|
return &ctypes.ResultBroadcastTx{}, nil
|
2015-03-26 21:30:42 -07:00
|
|
|
}
|
|
|
|
|
2015-08-10 20:38:45 -07:00
|
|
|
func ListUnconfirmedTxs() (*ctypes.ResultListUnconfirmedTxs, error) {
|
2015-09-25 12:55:59 -04:00
|
|
|
txs := mempoolReactor.Mempool.GetProposalTxs()
|
|
|
|
return &ctypes.ResultListUnconfirmedTxs{len(txs), txs}, nil
|
2015-04-25 13:26:36 -07:00
|
|
|
}
|