Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
remove random_nick including from add-on scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamISZ committed Sep 21, 2016
1 parent 8c2bb51 commit 93dfefc
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 51 deletions.
6 changes: 2 additions & 4 deletions broadcast-tx.py
Expand Up @@ -8,7 +8,6 @@

from joinmarket import OrderbookWatch, load_program_config, IRCMessageChannel
from joinmarket import jm_single, MessageChannelCollection
from joinmarket import random_nick
from joinmarket import get_log, debug_dump_object, get_irc_mchannels

log = get_log()
Expand Down Expand Up @@ -69,11 +68,10 @@ def main():
txhex = args[0]

load_program_config()
jm_single().nickname = random_nick()
log.debug('starting broadcast-tx')
mcs = [IRCMessageChannel(c, jm_single().nickname) for c in get_irc_mchannels()]
mcs = [IRCMessageChannel(c) for c in get_irc_mchannels()]
mcc = MessageChannelCollection(mcs)
taker = Broadcaster(mcc, options.waittime, txhex)
log.debug('starting broadcast-tx')
try:
log.debug('starting message channels')
mcc.run()
Expand Down
7 changes: 3 additions & 4 deletions create-unsigned-tx.py
Expand Up @@ -13,7 +13,7 @@
# import common
from joinmarket import taker as takermodule
from joinmarket import load_program_config, validate_address, \
jm_single, get_p2pk_vbyte, random_nick
jm_single, get_p2pk_vbyte
from joinmarket import get_log, choose_sweep_orders, choose_orders, \
pick_order, cheapest_order_choose, weighted_order_choose
from joinmarket import AbstractWallet, IRCMessageChannel, debug_dump_object, \
Expand Down Expand Up @@ -251,14 +251,13 @@ def main():
else: # choose randomly (weighted)
chooseOrdersFunc = weighted_order_choose

log.debug('starting sendpayment')

wallet = AbstractWallet()
wallet.unspent = None
mcs = [IRCMessageChannel(c, jm_single().nickname) for c in get_irc_mchannels()]
mcs = [IRCMessageChannel(c) for c in get_irc_mchannels()]
mcc = MessageChannelCollection(mcs)
taker = CreateUnsignedTx(mcc, wallet, cjamount, destaddr,
changeaddr, utxo_data, options, chooseOrdersFunc)
log.debug('starting create-unsigned-tx')
try:
log.debug('starting message channels')
mcc.run()
Expand Down
2 changes: 1 addition & 1 deletion joinmarket/__init__.py
Expand Up @@ -8,7 +8,7 @@
rand_norm_array, rand_pow_array, rand_exp_array, joinmarket_alert, core_alert
from .enc_wrapper import as_init_encryption, decode_decrypt, \
encrypt_encode, init_keypair, init_pubkey, get_pubkey, NaclError
from .irc import IRCMessageChannel, random_nick, B_PER_SEC
from .irc import IRCMessageChannel, B_PER_SEC
from .jsonrpc import JsonRpcError, JsonRpcConnectionError, JsonRpc
from .maker import Maker
from .message_channel import MessageChannel, MessageChannelCollection
Expand Down
27 changes: 0 additions & 27 deletions joinmarket/irc.py
Expand Up @@ -38,33 +38,6 @@

log = get_log()


def random_nick(nick_len=9):
vowels = "aeiou"
consonants = ''.join([chr(
c) for c in range(
ord('a'), ord('z') + 1) if vowels.find(chr(c)) == -1])
assert nick_len % 2 == 1
N = (nick_len - 1) / 2
rnd_consonants = [consonants[random.randrange(len(consonants))]
for _ in range(N + 1)]
rnd_vowels = [vowels[random.randrange(len(vowels))]
for _ in range(N)] + ['']
ircnick = ''.join([i for sl in zip(rnd_consonants, rnd_vowels) for i in sl])
ircnick = ircnick.capitalize()
# not using debug because it might not know the logfile name at this point
print('Generated random nickname: ' + ircnick)
return ircnick
# Other ideas for random nickname generation:
# - weight randomness by frequency of letter appearance
# - u always follows q
# - generate different length nicks
# - append two or more of these words together
# - randomly combine phonetic sounds instead consonants, which may be two consecutive consonants
# - e.g. th, dj, g, p, gr, ch, sh, kr,
# - neutral network that generates nicks


def get_irc_text(line):
return line[line[1:].find(':') + 2:]

Expand Down
2 changes: 1 addition & 1 deletion ob-watcher.py
Expand Up @@ -19,7 +19,7 @@
import matplotlib

from joinmarket import jm_single, load_program_config, MessageChannelCollection
from joinmarket import random_nick, calc_cj_fee, OrderbookWatch, get_irc_mchannels
from joinmarket import calc_cj_fee, OrderbookWatch, get_irc_mchannels
from joinmarket import IRCMessageChannel, get_log

log = get_log()
Expand Down
11 changes: 4 additions & 7 deletions patientsendpayment.py
Expand Up @@ -9,7 +9,6 @@
# sys.path.insert(0, os.path.join(data_dir, 'joinmarket'))
from joinmarket import Maker, Taker, load_program_config, IRCMessageChannel
from joinmarket import validate_address, jm_single
from joinmarket import random_nick
from joinmarket import get_log, choose_orders, weighted_order_choose, \
debug_dump_object
from joinmarket import Wallet
Expand Down Expand Up @@ -229,16 +228,14 @@ def main():
print 'not enough money at mixdepth=%d, exiting' % options.mixdepth
return

jm_single().nickname = random_nick()

log.debug('Running patient sender of a payment')

irc = IRCMessageChannel(jm_single().nickname)
PatientSendPayment(irc, wallet, destaddr, amount, options.makercount,
mcs = [IRCMessageChannel(c) for c in get_irc_mchannels()]
mcc = MessageChannelCollection(mcs)
PatientSendPayment(mcc, wallet, destaddr, amount, options.makercount,
options.txfee, options.cjfee, waittime,
options.mixdepth)
try:
irc.run()
mcc.run()
except:
log.debug('CRASHING, DUMPING EVERYTHING')
debug_dump_object(wallet, ['addr_cache', 'keys', 'seed'])
Expand Down
2 changes: 1 addition & 1 deletion test/test_podle.py
Expand Up @@ -16,7 +16,7 @@
from pprint import pformat
from joinmarket import Taker, load_program_config, IRCMessageChannel
from joinmarket import validate_address, jm_single, get_irc_mchannels
from joinmarket import random_nick, get_p2pk_vbyte, MessageChannelCollection
from joinmarket import get_p2pk_vbyte, MessageChannelCollection
from joinmarket import get_log, choose_sweep_orders, choose_orders, \
pick_order, cheapest_order_choose, weighted_order_choose, debug_dump_object
import joinmarket.irc
Expand Down
2 changes: 1 addition & 1 deletion test/test_regtest.py
Expand Up @@ -12,7 +12,7 @@
from joinmarket import (Taker, load_program_config, IRCMessageChannel,
BitcoinCoreWallet)
from joinmarket import validate_address, jm_single, get_irc_mchannels
from joinmarket import random_nick, get_p2pk_vbyte, MessageChannelCollection
from joinmarket import get_p2pk_vbyte, MessageChannelCollection
from joinmarket import get_log, choose_sweep_orders, choose_orders, \
pick_order, cheapest_order_choose, weighted_order_choose, debug_dump_object
import joinmarket.irc
Expand Down
6 changes: 2 additions & 4 deletions test/test_tumbler.py
Expand Up @@ -10,7 +10,7 @@
import time
from joinmarket import Taker, load_program_config, IRCMessageChannel
from joinmarket import validate_address, jm_single, MessageChannelCollection
from joinmarket import random_nick, get_p2pk_vbyte, get_irc_mchannels
from joinmarket import get_p2pk_vbyte, get_irc_mchannels
from joinmarket import get_log, choose_sweep_orders, choose_orders, \
pick_order, cheapest_order_choose, weighted_order_choose, debug_dump_object
import json
Expand Down Expand Up @@ -145,13 +145,11 @@ def test_tumbler(setup_tumbler, num_ygs, wallet_structures, mean_amt, sdev_amt,
print('estimated time taken ' + str(total_block_and_wait) + ' minutes or ' +
str(round(total_block_and_wait / 60.0, 2)) + ' hours')

jm_single().nickname = random_nick()

log.debug('starting tumbler')

jm_single().bc_interface.sync_wallet(wallet)
jm_single().bc_interface.pushtx_failure_prob = 0.4
mcs = [IRCMessageChannel(c, jm_single().nickname) for c in get_irc_mchannels()]
mcs = [IRCMessageChannel(c) for c in get_irc_mchannels()]
mcc = MessageChannelCollection(mcs)
tumbler_bot = tumbler.Tumbler(mcc, wallet, tx_list, options)
try:
Expand Down
1 change: 0 additions & 1 deletion tumbler.py
Expand Up @@ -14,7 +14,6 @@
from joinmarket import jm_single, Taker, load_program_config, \
IRCMessageChannel, MessageChannelCollection
from joinmarket import validate_address
from joinmarket import random_nick
from joinmarket import get_log, rand_norm_array, rand_pow_array, \
rand_exp_array, choose_orders, weighted_order_choose, choose_sweep_orders, \
debug_dump_object, get_irc_mchannels
Expand Down

0 comments on commit 93dfefc

Please sign in to comment.