bbc1.core.domain0_manager module

Copyright (c) 2017 beyond-blockchain.org.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class bbc1.core.domain0_manager.Domain0Manager(networking=None, node_id=None, loglevel='all', logname=None)[source]

Bases: object

Management for inter-domain collaboration over domain_global_0

ADV_DOMAIN_LIST = b'\x00\x00'
CROSS_REF_PROBABILITY = 0.1
DISTRIBUTE_CROSS_REF = b'\x00\x01'
DOMAIN_ACCEPTANCE_RECOVER_INTERVAL = 600
DOMAIN_INFO_ADVERTISE_INTERVAL = 1800
DOMAIN_INFO_LIFETIME = 3600
INITIAL_ACCEPT_LIMIT = 10
NOTIFY_CROSS_REF_REGISTERED = b'\x00\x02'
NUM_OF_COPIES = 3
REQUEST_VERIFY = b'\x00\x04'
REQUEST_VERIFY_FROM_OUTER_DOMAIN = b'\x00\x05'
RESPONSE_VERIFY_FROM_OUTER_DOMAIN = b'\x00\x06'
cross_ref_registered(domain_id, transaction_id, cross_ref)[source]

Notify cross_ref inclusion in a transaction of the outer domain and insert the info into DB

Parameters:
  • domain_id (bytes) – domain_id where the cross_ref is from
  • transaction_id (bytes) – transaction_id that the cross_ref proves
  • cross_ref (bytes) – the registered cross_ref in other domain
distribute_cross_ref_in_domain0(domain_id, transaction_id)[source]

Determine if the node distributes the cross_ref (into domain_global_0)

Parameters:
  • domain_id (bytes) – target domain_id
  • transaction_id (bytes) – target transaction_id
process_message(msg)[source]

Process received message

Parameters:msg (dict) – received message
stop_all_timers()[source]

Invalidate all running timers

update_domain_belong_to()[source]

Update the list domain_belong_to

domain_belong_to holds all domain_ids that this node belongs to