Skip to content

Commit

Permalink
feat(network): add sanchonet compatibility (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega authored Dec 12, 2023
1 parent 6f1b152 commit 4923889
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pallas-network/src/miniprotocols/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ pub const MAINNET_MAGIC: u64 = 764824073;
/// Well-known magic for preview
pub const PREVIEW_MAGIC: u64 = 2;

/// Well-known magic for pre-production
/// Well-known magic for preprod
pub const PREPROD_MAGIC: u64 = 1;

/// Alias for PREPROD_MAGIC
pub const PRE_PRODUCTION_MAGIC: u64 = 1;

/// Well-known magic for preprod
pub const SANCHONET_MAGIC: u64 = 4;

/// Bitflag for client-side version of a known protocol
/// # Example
/// ```
Expand Down
3 changes: 3 additions & 0 deletions pallas-network/src/miniprotocols/handshake/n2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const PROTOCOL_V12: u64 = 32780;
const PROTOCOL_V13: u64 = 32781;
const PROTOCOL_V14: u64 = 32782;
const PROTOCOL_V15: u64 = 32783;
const PROTOCOL_V16: u64 = 32784;

impl VersionTable {
pub fn v1_and_above(network_magic: u64) -> VersionTable {
Expand All @@ -41,6 +42,7 @@ impl VersionTable {
(PROTOCOL_V13, VersionData(network_magic, None)),
(PROTOCOL_V14, VersionData(network_magic, None)),
(PROTOCOL_V15, VersionData(network_magic, Some(false))),
(PROTOCOL_V16, VersionData(network_magic, Some(false))),
]
.into_iter()
.collect::<HashMap<u64, VersionData>>();
Expand All @@ -64,6 +66,7 @@ impl VersionTable {
(PROTOCOL_V13, VersionData(network_magic, None)),
(PROTOCOL_V14, VersionData(network_magic, None)),
(PROTOCOL_V15, VersionData(network_magic, Some(false))),
(PROTOCOL_V16, VersionData(network_magic, Some(false))),
]
.into_iter()
.collect::<HashMap<u64, VersionData>>();
Expand Down

0 comments on commit 4923889

Please sign in to comment.