def receive_tx_list_event(txList, gatewayId, tokenTime, eventTime): eventType = "receive_tx_list" if eventTime <= p.simTime: block = AB() block.transactions = txList.copy() block.timestamp = tokenTime event = Event(eventType, gatewayId, eventTime, block) Queue.add_event(event)
def create_block_event_AB(node, eventTime, receiverGatewayId): eventType = "create_block" if eventTime <= p.simTime: # Populate event attributes block = AB() block.id = random.randrange(100000000000) block.timestamp = eventTime block.nodeId = node.id block.gatewayIds = node.gatewayIds block.receiverGatewayId = receiverGatewayId event = Event(eventType, node.id, eventTime, block) Queue.add_event(event) # add the event to the queue