mirror of
https://github.com/tendermint/tendermint.git
synced 2026-05-21 22:51:30 +00:00
move size check into loop
This commit is contained in:
@@ -261,6 +261,9 @@ func (rpp *ResponsePrepareProposal) Validate(maxSizeBytes int64, otxs [][]byte)
|
||||
for _, tr := range rpp.TxRecords {
|
||||
if tr.isIncluded() {
|
||||
size += int64(len(tr.Tx))
|
||||
if size > maxSizeBytes {
|
||||
return fmt.Errorf("transaction data size %d exceeds maximum %d", size, maxSizeBytes)
|
||||
}
|
||||
if _, ok := ntx[string(tr.Tx)]; ok {
|
||||
return errors.New("duplicate included transaction")
|
||||
}
|
||||
@@ -279,8 +282,5 @@ func (rpp *ResponsePrepareProposal) Validate(maxSizeBytes int64, otxs [][]byte)
|
||||
return fmt.Errorf("transaction incorrectly marked as %s", tr.Action.String())
|
||||
}
|
||||
}
|
||||
if size > maxSizeBytes {
|
||||
return fmt.Errorf("transaction data size %d exceeds maximum %d", size, maxSizeBytes)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user