rpc: add codespace to ResultBroadcastTx (#4611)

Closes: #4606
This commit is contained in:
Yongwoo Lee
2020-03-31 16:49:28 +09:00
committed by GitHub
parent f5651d2b61
commit bcf27c2364
5 changed files with 28 additions and 9 deletions

View File

@@ -16,6 +16,8 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
### FEATURES:
- [rpc] [\#4611](https://github.com/tendermint/tendermint/pull/4611) Add `codespace` to `ResultBroadcastTx` (@whylee259)
### IMPROVEMENTS:
- [p2p] [\#4548](https://github.com/tendermint/tendermint/pull/4548) Add ban list to address book (@cmwaters)

View File

@@ -63,7 +63,13 @@ func (a ABCIApp) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error
if !c.IsErr() {
go func() { a.App.DeliverTx(abci.RequestDeliverTx{Tx: tx}) }() // nolint: errcheck
}
return &ctypes.ResultBroadcastTx{Code: c.Code, Data: c.Data, Log: c.Log, Hash: tx.Hash()}, nil
return &ctypes.ResultBroadcastTx{
Code: c.Code,
Data: c.Data,
Log: c.Log,
Codespace: c.Codespace,
Hash: tx.Hash(),
}, nil
}
func (a ABCIApp) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
@@ -72,7 +78,13 @@ func (a ABCIApp) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)
if !c.IsErr() {
go func() { a.App.DeliverTx(abci.RequestDeliverTx{Tx: tx}) }() // nolint: errcheck
}
return &ctypes.ResultBroadcastTx{Code: c.Code, Data: c.Data, Log: c.Log, Hash: tx.Hash()}, nil
return &ctypes.ResultBroadcastTx{
Code: c.Code,
Data: c.Data,
Log: c.Log,
Codespace: c.Codespace,
Hash: tx.Hash(),
}, nil
}
// ABCIMock will send all abci related request to the named app,

View File

@@ -43,10 +43,11 @@ func BroadcastTxSync(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcas
res := <-resCh
r := res.GetCheckTx()
return &ctypes.ResultBroadcastTx{
Code: r.Code,
Data: r.Data,
Log: r.Log,
Hash: tx.Hash(),
Code: r.Code,
Data: r.Data,
Log: r.Log,
Codespace: r.Codespace,
Hash: tx.Hash(),
}, nil
}

View File

@@ -148,9 +148,10 @@ type ResultConsensusState struct {
// CheckTx result
type ResultBroadcastTx struct {
Code uint32 `json:"code"`
Data bytes.HexBytes `json:"data"`
Log string `json:"log"`
Code uint32 `json:"code"`
Data bytes.HexBytes `json:"data"`
Log string `json:"log"`
Codespace string `json:"codespace"`
Hash bytes.HexBytes `json:"hash"`
}

View File

@@ -2947,6 +2947,9 @@ components:
log:
type: "string"
example: ""
codespace:
type: "string"
example: "ibc"
hash:
type: "string"
example: "0D33F2F03A5234F38706E43004489E061AC40A2E"