fix: all fast sync nodes report to peers as full nodes (#1547)

* fix: all fast sync nodes report to peers as full nodes
This commit is contained in:
Gary Yu
2018-09-20 07:09:39 +08:00
committed by GitHub
parent 2ca6ecc163
commit 56ffbee7e9
4 changed files with 34 additions and 4 deletions
+2 -2
View File
@@ -54,12 +54,12 @@ impl Server {
adapter: Arc<ChainAdapter>,
genesis: Hash,
stop: Arc<AtomicBool>,
archive_mode: bool,
_archive_mode: bool,
block_1_hash: Option<Hash>,
) -> Result<Server, Error> {
// In the case of an archive node, check that we do have the first block.
// In case of first sync we do not perform this check.
if archive_mode && adapter.total_height() > 0 {
if capab.contains(Capabilities::FULL_HIST) && adapter.total_height() > 0 {
// Check that we have block 1
match block_1_hash {
Some(hash) => match adapter.get_block(hash) {
+4 -1
View File
@@ -128,7 +128,7 @@ impl Default for P2PConfig {
P2PConfig {
host: ipaddr,
port: 13414,
capabilities: Capabilities::FULL_NODE,
capabilities: Capabilities::FAST_SYNC_NODE,
seeding_type: Seeding::default(),
seeds: None,
peers_allow: None,
@@ -202,6 +202,9 @@ bitflags! {
/// Can provide a list of healthy peers
const PEER_LIST = 0b00000100;
const FAST_SYNC_NODE = Capabilities::TXHASHSET_HIST.bits
| Capabilities::PEER_LIST.bits;
const FULL_NODE = Capabilities::FULL_HIST.bits
| Capabilities::TXHASHSET_HIST.bits
| Capabilities::PEER_LIST.bits;