mirror of https://github.com/vacp2p/research.git
Variable host
This commit is contained in:
parent
f88ccf5d2e
commit
ff4dddb71b
|
@ -3,11 +3,13 @@ import networkwhisper, sync, sys, threading, time
|
|||
# XXX: Ugly constants, should be elsewhere
|
||||
SETTINGS = {
|
||||
'a': {
|
||||
'host': "http://localhost:8500",
|
||||
'keypair': "0x57083392b29bdf24512c93cfdf45d38c87d9d882da3918c59f4406445ea976a4",
|
||||
'pubkey': "0x04d94a1a01872b598c7cdc5aca2358d35eb91cd8a91eaea8da277451bb71d45c0d1eb87a31ea04e32f537e90165c870b3e115a12438c754d507ac75bddd6ecacd5",
|
||||
'friend' : "0x04ff921ddf78b5ed4537402f59a150caf9d96a83f2a345a1ddf9df12e99e7778f314c9ca72e8285eb213af84f5a7b01aabb62c67e46657976ded6658e1b9e83c73" #b
|
||||
},
|
||||
'b': {
|
||||
'host': "http://localhost:8501",
|
||||
'keypair': "0x7b5c5af9736d9f1773f2020dd0fef0bc3c8aeaf147d2bf41961e766588e086e7",
|
||||
'pubkey' : "0x04ff921ddf78b5ed4537402f59a150caf9d96a83f2a345a1ddf9df12e99e7778f314c9ca72e8285eb213af84f5a7b01aabb62c67e46657976ded6658e1b9e83c73",
|
||||
'friend': "0x04d94a1a01872b598c7cdc5aca2358d35eb91cd8a91eaea8da277451bb71d45c0d1eb87a31ea04e32f537e90165c870b3e115a12438c754d507ac75bddd6ecacd5" #a
|
||||
|
@ -29,10 +31,11 @@ def main():
|
|||
settings = SETTINGS[sys.argv[1]]
|
||||
keypair = settings['keypair']
|
||||
identity_pk = settings['pubkey']
|
||||
host = settings['host']
|
||||
friend_pk = settings['friend']
|
||||
|
||||
# Init node
|
||||
whisper_node = networkwhisper.WhisperNodeHelper(keypair)
|
||||
whisper_node = networkwhisper.WhisperNodeHelper(keypair, host)
|
||||
node = sync.Node(identity_pk, whisper_node, 'onlineDesktop', 'interactive')
|
||||
|
||||
#where?
|
||||
|
|
|
@ -6,11 +6,9 @@ import random
|
|||
import sync_pb2
|
||||
|
||||
# XXX: This assumes a node is actually running - shell out to boot geth?
|
||||
# At least error if proc not running
|
||||
class WhisperNodeHelper():
|
||||
def __init__(self, keypair):
|
||||
# XXX: Whisper specific, but this host should be unique per node
|
||||
self.host = "http://localhost:8500"
|
||||
def __init__(self, keypair, host):
|
||||
self.host = host
|
||||
self.web3 = Web3(HTTPProvider(self.host))
|
||||
Shh.attach(self.web3, "shh")
|
||||
|
||||
|
|
Loading…
Reference in New Issue