Skip to content

Commit

Permalink
add BLOCK_HIST capabilities on startup if config archive_mode=true (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
antiochp committed Feb 23, 2021
1 parent 9c44a4d commit 08523b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions p2p/src/types.rs
Expand Up @@ -391,6 +391,8 @@ bitflags! {
const TX_KERNEL_HASH = 0b0000_1000;
/// Can provide PIBD segments during initial byte download (fast sync).
const PIBD_HIST = 0b0001_0000;
/// Can provide historical blocks for archival sync.
const BLOCK_HIST = 0b0010_0000;
}
}

Expand Down
10 changes: 7 additions & 3 deletions servers/src/grin/server.rs
Expand Up @@ -214,9 +214,13 @@ impl Server {
init_net_hooks(&config),
));

// Use our default capabilities here.
// We will advertize these to our peers during hand/shake.
let capabilities = Capabilities::default();
// Initialize our capabilities.
// Currently either "default" or with optional "archive_mode" (block history) support enabled.
let capabilities = if let Some(true) = config.archive_mode {
Capabilities::default() | Capabilities::BLOCK_HIST
} else {
Capabilities::default()
};
debug!("Capabilities: {:?}", capabilities);

let p2p_server = Arc::new(p2p::Server::new(
Expand Down

0 comments on commit 08523b2

Please sign in to comment.