FromVersionForWrites returns a versioned encoding for the provided string, but only for encodings that are supported for creating new blocks. Deprecated or readonly encodings will return an error.
(v string)
| 84 | // FromVersionForWrites returns a versioned encoding for the provided string, but only for |
| 85 | // encodings that are supported for creating new blocks. Deprecated or readonly encodings will return an error. |
| 86 | func FromVersionForWrites(v string) (VersionedEncoding, error) { |
| 87 | enc, err := FromVersion(v) |
| 88 | if err != nil { |
| 89 | return nil, err |
| 90 | } |
| 91 | if !enc.WritesSupported() { |
| 92 | return nil, fmt.Errorf("%s is not a valid block version for creating blocks", v) |
| 93 | } |
| 94 | return enc, nil |
| 95 | } |
| 96 | |
| 97 | // DefaultEncoding for newly written blocks. |
| 98 | func DefaultEncoding() VersionedEncoding { |
no test coverage detected