|
@ -138,22 +138,10 @@ func TxProofFromProto(pb tmproto.TxProof) (TxProof, error) { |
|
|
return pbtp, nil |
|
|
return pbtp, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// ComputeProtoOverheadForTxs wraps the transactions in tmproto.Data{} and calculates the size.
|
|
|
|
|
|
|
|
|
// ComputeProtoSizeForTxs wraps the transactions in tmproto.Data{} and calculates the size.
|
|
|
// https://developers.google.com/protocol-buffers/docs/encoding
|
|
|
// https://developers.google.com/protocol-buffers/docs/encoding
|
|
|
func ComputeProtoSizeForTxs(txs []Tx, tx Tx) int64 { |
|
|
|
|
|
tt := make(Txs, len(txs)+1) |
|
|
|
|
|
|
|
|
|
|
|
tt = append(tt, txs...) |
|
|
|
|
|
tt = append(tt, tx) |
|
|
|
|
|
data := Data{Txs: tt} |
|
|
|
|
|
|
|
|
func ComputeProtoSizeForTxs(txs []Tx) int64 { |
|
|
|
|
|
data := Data{Txs: txs} |
|
|
pdData := data.ToProto() |
|
|
pdData := data.ToProto() |
|
|
return int64(pdData.Size()) |
|
|
return int64(pdData.Size()) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// ComputeProtoSizeForTx wraps the transaction in tmproto.Data{} and calculates the size.
|
|
|
|
|
|
// https://developers.google.com/protocol-buffers/docs/encoding
|
|
|
|
|
|
func ComputeProtoSizeForTx(tx Tx) int64 { |
|
|
|
|
|
pbdata := tmproto.Data{Txs: [][]byte{tx}} |
|
|
|
|
|
|
|
|
|
|
|
return int64(pbdata.Size()) |
|
|
|
|
|
} |
|
|
|