siliqua.network.nano_node package¶
Submodules¶
siliqua.network.nano_node.base module¶
-
class
siliqua.network.nano_node.base.NetworkProcessorBase(network_plugin)¶ Bases:
object-
NETWORK_ERROR_WAIT_SECONDS= 1¶
-
NETWORK_LOOP_WAIT_SECONDS= 0.1¶
-
NETWORK_TIMEOUT_SECONDS= 10¶
-
REQUIRED_PROTOCOL_VERSION= 17¶
-
async
do_json_post(url, params)¶
-
async
get_link_blocks(block_hashes)¶
-
property
work_difficulty¶
-
-
async
siliqua.network.nano_node.base.do_json_post(url, params, session)¶
-
siliqua.network.nano_node.base.get_block_from_json(block_data)¶ Deserialize block data received from a node’s JSON response to a Block instance.
JSON response may include extra data such as a timestamp, so include those as well
-
siliqua.network.nano_node.base.get_link_block_from_json(block_data)¶ Deserialize block data received from a node’s JSON response to a LinkBlock instance.
-
siliqua.network.nano_node.base.get_link_block_hash(block, subtype)¶
-
siliqua.network.nano_node.base.get_raw_block_from_json(block_data)¶
siliqua.network.nano_node.rpc module¶
-
class
siliqua.network.nano_node.rpc.RPCProcessor(*args, **kwargs)¶ Bases:
siliqua.network.nano_node.base.NetworkProcessorBase-
CONFIRMATION_POLL_INTERVAL_SECONDS= 1¶
-
CONFIRMATION_TIMEOUT_SECONDS= 300¶
-
FAST_POLL_INTERVAL_SECONDS= 5¶
-
POLL_INTERVAL_SECONDS= 120¶
-
async
broadcast_block(block)¶ Broadcast a single block and wait until it is complete
-
async
check_node_version()¶ Check the node version in use and return True if the node version is recent enough
-
async
loop()¶ The main event loop that continues endlessly until the shutdown flag is activated
-
property
poll_interval¶ Return HTTP poll interval depending on whether a WebSocket connection is active
-
async
update_account_blocks(account_id)¶ Update an account’s block in two requests: first request to check account’s (unconfirmed) blockchain second request to retrieve related link blocks and check blocks’ confirmation status
-
async
update_active_difficulty()¶ Check the active difficulty on the network and update accordingly
-
async
update_broadcast_blocks()¶ Broadcast blocks in the queue one-by-one until the queue is exhausted
-
async
update_new_blocks()¶ Check the network for any new blocks to add to the queue
-
async
update_pocketable_blocks()¶
-
siliqua.network.nano_node.ws module¶
-
class
siliqua.network.nano_node.ws.WebSocketProcessor(*args, **kwargs)¶ Bases:
siliqua.network.nano_node.base.NetworkProcessorBase-
async
listen_for_msg()¶
-
async
loop()¶ The main event loop that continues endlessly until the shutdown flag is activated
-
async
process_account_block_message(block_data, account_id, subtype)¶
-
async
process_block_message(response)¶ Process a block and insert it into the account and/or pocketable queue
-
async
process_pocketable_block_message(block_data, amount)¶
-
async
update_listen_subscription()¶
-
async
Module contents¶
-
class
siliqua.network.nano_node.NetworkPlugin(*args, **kwargs)¶ Bases:
siliqua.network.BaseNetworkPlugin-
PLUGIN_NAME= 'nano_node'¶
-
validate_config()¶ Method that validates the plugin-specific configuration and raises
siliqua.exceptions.ConfigurationErrorfor any incomplete or invalid configuration field
-
-
siliqua.network.nano_node.run_network_thread(network_plugin)¶ Start looping RPC and WebSocket asynchronous network tasks
-
async
siliqua.network.nano_node.run_rpc_processor(network_plugin)¶
-
async
siliqua.network.nano_node.run_websocket_processor(network_plugin)¶