Skip to content

Commit

Permalink
fix: Remove ProtocolConfigV0
Browse files Browse the repository at this point in the history
  • Loading branch information
dhedey committed Jan 23, 2024
1 parent 20afd23 commit 7476582
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,11 @@ public static void registerCodec(CodecMap codecMap) {
codecs -> StructCodec.fromRecordComponents(ProtocolConfig.class, codecs));
}

public static ProtocolConfig sborDecodeWithFallbackForOldVersions(byte[] encoded) {
public static ProtocolConfig sborDecode(byte[] encoded, String errorMessage) {
try {
return NodeSborCodecs.decode(encoded, NodeSborCodecs.resolveCodec(new TypeToken<>() {}));
} catch (SborDecodeException ex) {
return NodeSborCodecs.decode(
encoded, NodeSborCodecs.resolveCodec(new TypeToken<ProtocolConfigV0>() {}))
.update();
throw new RuntimeException(errorMessage, ex);
}
}

Expand Down

This file was deleted.

4 changes: 3 additions & 1 deletion core/src/main/java/com/radixdlt/RadixNodeModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ protected void configure() {
final ProtocolConfig protocolConfig;
if (!customProtocolConfig.isEmpty()) {
protocolConfig =
ProtocolConfig.sborDecodeWithFallbackForOldVersions(Hex.decode(customProtocolConfig));
ProtocolConfig.sborDecode(
Hex.decode(customProtocolConfig),
"Could not decode protocol custom_config. It may need regenerating.");
} else {
protocolConfig = ProtocolConfig.resolveForNetwork(NetworkDefinition.from(network));
}
Expand Down

0 comments on commit 7476582

Please sign in to comment.