rpc: return (*Response, error) for all functions

This commit is contained in:
Ethan Buchman
2015-03-28 23:10:05 -07:00
parent d30fc2fa43
commit 731de7a6aa
11 changed files with 58 additions and 49 deletions

View File

@ -18,10 +18,10 @@ type Receipt struct {
// pass pointer?
// Note: tx must be signed
func BroadcastTx(tx types.Tx) (Receipt, error) {
func BroadcastTx(tx types.Tx) (*ResponseBroadcastTx, error) {
err := mempoolReactor.BroadcastTx(tx)
if err != nil {
return Receipt{}, fmt.Errorf("Error broadcasting transaction: %v", err)
return nil, fmt.Errorf("Error broadcasting transaction: %v", err)
}
txHash := merkle.HashFromBinary(tx)
@ -34,7 +34,7 @@ func BroadcastTx(tx types.Tx) (Receipt, error) {
contractAddr = state.NewContractAddress(callTx.Input.Address, uint64(callTx.Input.Sequence))
}
}
return Receipt{txHash, createsContract, contractAddr}, nil
return &ResponseBroadcastTx{Receipt{txHash, createsContract, contractAddr}}, nil
}
/*