Exemplo n.º 1
0
def test_dashd():
    config_text = DashConfig.slurp_config_file(config.dash_conf)
    creds = DashConfig.get_rpc_creds(config_text, 'testnet')

    dashd = DashDaemon(
        user     = creds.get('user'),
        password = creds.get('password'),
        port     = creds.get('port')
    )
    assert dashd.rpc_command != None

    assert hasattr(dashd, 'rpc_connection') == True

    # Dash testnet block 0 hash == 00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c
    # test commands without arguments
    info  = dashd.rpc_command('getinfo')

    info_keys = [
        'blocks',
        'connections',
        'difficulty',
        'errors',
        'protocolversion',
        'proxy',
        'testnet',
        'timeoffset',
        'version',
    ]
    for key in info_keys:
        assert key in info
    assert info['testnet'] == True

    # test commands with args
    assert dashd.rpc_command('getblockhash', 0)   == u'00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c'
Exemplo n.º 2
0
def test_dashd():
    config_text = DashConfig.slurp_config_file(config.dash_conf)
    network = 'mainnet'
    is_testnet = False
    genesis_hash = u'00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6'
    for line in config_text.split("\n"):
        if line.startswith('testnet=1'):
            network = 'testnet'
            is_testnet = True
            genesis_hash = u'00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c'

    creds = DashConfig.get_rpc_creds(config_text, network)
    dashd = DashDaemon(**creds)
    assert dashd.rpc_command is not None

    assert hasattr(dashd, 'rpc_connection')

    # Dash testnet block 0 hash == 00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c
    # test commands without arguments
    info = dashd.rpc_command('getinfo')
    info_keys = [
        'blocks',
        'connections',
        'difficulty',
        'errors',
        'protocolversion',
        'proxy',
        'testnet',
        'timeoffset',
        'version',
    ]
    for key in info_keys:
        assert key in info
    assert info['testnet'] is is_testnet

    # test commands with args
    assert dashd.rpc_command('getblockhash', 0) == genesis_hash
Exemplo n.º 3
0
def test_dashd():
    config_text = DashConfig.slurp_config_file(config.dash_conf)
    network = 'mainnet'
    is_testnet = False
    genesis_hash = u'000001f47616c621df9a832559b9e562176656bc5d7e753018983ad8c0b2d284'
    for line in config_text.split("\n"):
        if line.startswith('testnet=1'):
            network = 'testnet'
            is_testnet = True
            genesis_hash = u'0000095981c16c629ffafa06d096d686486a7698d9ba14db7dfa72fd4a6a36de'

    creds = DashConfig.get_rpc_creds(config_text, network)
    dashd = DashDaemon(**creds)
    assert dashd.rpc_command is not None

    assert hasattr(dashd, 'rpc_connection')

    # Dash testnet block 0 hash == 00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c
    # test commands without arguments
    info = dashd.rpc_command('getinfo')
    info_keys = [
        'blocks',
        'connections',
        'difficulty',
        'errors',
        'protocolversion',
        'proxy',
        'testnet',
        'timeoffset',
        'version',
    ]
    for key in info_keys:
        assert key in info
    assert info['testnet'] is is_testnet

    # test commands with args
    assert dashd.rpc_command('getblockhash', 0) == genesis_hash
Exemplo n.º 4
0
def test_dashd():
    config_text = DashConfig.slurp_config_file(config.dash_conf)
    network = 'mainnet'
    is_testnet = False
    genesis_hash = u'00000ee6635b617e6b850ba638411c956bc5e0b977c2aa466a2116b4b767599c'
    for line in config_text.split("\n"):
        if line.startswith('testnet=1'):
            network = 'testnet'
            is_testnet = True
            genesis_hash = u'000004d72c95dada076575d05dddfb8be794c5ff8e6fa983e18b509995a03740'

    creds = DashConfig.get_rpc_creds(config_text, network)
    dashd = DashDaemon(**creds)
    assert dashd.rpc_command is not None

    assert hasattr(dashd, 'rpc_connection')

    # LUSO testnet block 0 hash == 000004d72c95dada076575d05dddfb8be794c5ff8e6fa983e18b509995a03740
    # test commands without arguments
    info = dashd.rpc_command('getinfo')
    info_keys = [
        'blocks',
        'connections',
        'difficulty',
        'errors',
        'protocolversion',
        'proxy',
        'testnet',
        'timeoffset',
        'version',
    ]
    for key in info_keys:
        assert key in info
    assert info['testnet'] is is_testnet

    # test commands with args
    assert dashd.rpc_command('getblockhash', 0) == genesis_hash
Exemplo n.º 5
0
def test_dashd():
    config_text = DashConfig.slurp_config_file(config.dash_conf)
    network = 'mainnet'
    is_testnet = False
    genesis_hash = u'00000c63f5826a523923939a5adf28657c2a6b76764f1af99bb39437006489d3'
    for line in config_text.split("\n"):
        if line.startswith('testnet=1'):
            network = 'testnet'
            is_testnet = True
            genesis_hash = u'00000341adf1dd4375bef8ff8059b4268fe0282d8a66f8cf5419bd6b13fbb77b'

    creds = DashConfig.get_rpc_creds(config_text, network)
    dashd = DashDaemon(**creds)
    assert dashd.rpc_command is not None

    assert hasattr(dashd, 'rpc_connection')

    # Dash testnet block 0 hash == 00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c
    # test commands without arguments
    info = dashd.rpc_command('getinfo')
    info_keys = [
        'blocks',
        'connections',
        'difficulty',
        'errors',
        'protocolversion',
        'proxy',
        'testnet',
        'timeoffset',
        'version',
    ]
    for key in info_keys:
        assert key in info
    assert info['testnet'] is is_testnet

    # test commands with args
    assert dashd.rpc_command('getblockhash', 0) == genesis_hash
Exemplo n.º 6
0
sbobj = Superblock(
    event_block_height=event_block_height,
    payment_addresses='yYe8KwyaUu5YswSYmB3q3ryx8XTUu9y7Ui',
    payment_amounts='{0}'.format(payment_amounts),
    proposal_hashes=
    'e8a0057914a2e1964ae8a945c4723491caae2077a90a00a2aabee22b40081a87',
)

ratecheckbuffer = list()

#hash = sbobj.submit(node1)
#cmd = sbobj.get_submit_command()

sb_time = int(now())
cmd = ['gobject', 'submit', '0', '1', str(sb_time), sbobj.dashd_serialise()]
object_hash = node1.rpc_command(*cmd)

print '\nperform basic checks\n'
ratecheckbuffer.append(sb_time)

log1.expect_minimum('push_inventory:govobj {0}'.format(object_hash), 1)

log2.expect('govobj_accepted:{0}'.format(object_hash), 1)
log3.expect('govobj_accepted:{0}'.format(object_hash), 1)

log2.expect_minimum('push_inventory:govobj {0}'.format(object_hash), 1)
log3.expect_minimum('push_inventory:govobj {0}'.format(object_hash), 1)

print '\nwaiting 15 seconds'
time.sleep(15)
Exemplo n.º 7
0
log1 = testtools.LogListener('/tmp/node10', 10)
log2 = testtools.LogListener('/tmp/node8', 10)
log3 = testtools.LogListener('/tmp/node9', 10)

while (not node1.is_synced() or not node2.is_synced()
       or not node3.is_synced()):
    print('not yet synced, sleep 5 sec')
    time.sleep(5)

# create proposal

payout_amount = 0.2
payout_month = 50

curunixtime = now()
payout_address = node1.rpc_command("getnewaddress")
proposalfee = node1.proposalfee()
superblockcycle = node1.superblockcycle()
nextsuperblock = node1.next_superblock_height()
curblock = node1.last_superblock_height()

if nextsuperblock - curblock > 10:
    start_epoch = curunixtime
else:
    start_epoch = int(curunixtime + (superblockcycle * 2.6 * 60))

end_epoch = int(start_epoch + payout_month * (superblockcycle * 2.6 * 60) +
                ((superblockcycle / 2) * 2.6 * 60))

proposal = Proposal(name='proposal_' + str(curblock),
                    url='https://dashcentral.com/proposal_' + str(curblock) +
Exemplo n.º 8
0
event_block_height = node1.next_superblock_height()
payment_amounts = 1

sbobj = Superblock(
    event_block_height=event_block_height,
    payment_addresses='yYe8KwyaUu5YswSYmB3q3ryx8XTUu9y7Ui',
    payment_amounts='{0}'.format(payment_amounts),
    proposal_hashes=
    'e8a0057914a2e1964ae8a945c4723491caae2077a90a00a2aabee22b40081a87',
)

ratecheckbuffer = list()

sb_time = int(now())
cmd = ['gobject', 'submit', '0', '1', str(sb_time), sbobj.dashd_serialise()]
object_hash = node1.rpc_command(*cmd)

print '\nperform basic checks\n'
ratecheckbuffer.append(sb_time)

log1.expect_minimum('push_inventory:govobj {0}'.format(object_hash), 1)

log2.expect('govobj_accepted:{0}'.format(object_hash), 1)
log3.expect('govobj_accepted:{0}'.format(object_hash), 1)

log2.expect_minimum('push_inventory:govobj {0}'.format(object_hash), 1)
log3.expect_minimum('push_inventory:govobj {0}'.format(object_hash), 1)

print '\nwaiting 10 seconds'
time.sleep(10)
Exemplo n.º 9
0
#log3 = testtools.LogListener('/tmp/node3', 10)

nSuperblockCycleSeconds = node1.superblockcycle() * nPowTargetSpacing

while (not node1.is_synced() or not node2.is_synced()
       or not node3.is_synced()):
    print('not yet synced, sleep 30 sec')
    time.sleep(30)

# create proposal

payout_amount = 0.2
payout_month = 50

curunixtime = now()
payout_address = node1.rpc_command("getnewaddress")
proposalfee = node1.proposalfee()
superblockcycle = node1.superblockcycle()
nextsuperblock = node1.next_superblock_height()
curblock = node1.last_superblock_height()

if nextsuperblock - curblock > 10:
    start_epoch = curunixtime
else:
    start_epoch = int(curunixtime + (superblockcycle * 2.6 * 60))

end_epoch = int(start_epoch + payout_month * (superblockcycle * 2.6 * 60) +
                ((superblockcycle / 2) * 2.6 * 60))

proposal = Proposal(name='proposal_' + str(curblock),
                    url='https://dashcentral.com/proposal_' + str(curblock) +