Esempio n. 1
0
import pprint
import sys
import threading

import bitcoin as btc
from joinmarket import IRCMessageChannel
from joinmarket.configure import get_p2pk_vbyte, load_program_config, jm_single, \
     check_utxo_blacklist
from joinmarket.enc_wrapper import init_keypair, as_init_encryption, init_pubkey, \
     NaclError

from joinmarket.support import get_log, calc_cj_fee, debug_dump_object
from joinmarket.taker import OrderbookWatch
from joinmarket.wallet import Wallet

log = get_log()


class CoinJoinOrder(object):
    def __init__(self, maker, nick, oid, amount, taker_pk):
        self.tx = None
        self.i_utxo_pubkey = None

        self.maker = maker
        self.oid = oid
        self.cj_amount = amount
        if self.cj_amount <= jm_single().BITCOIN_DUST_THRESHOLD:
            self.maker.msgchan.send_error(nick, 'amount below dust threshold')
        # the btc pubkey of the utxo that the taker plans to use as input
        self.taker_pk = taker_pk
        # create DH keypair on the fly for this Order object
Esempio n. 2
0
from __future__ import absolute_import, print_function

import io
import logging
import threading

from ConfigParser import SafeConfigParser, NoOptionError

import bitcoin as btc
from joinmarket.jsonrpc import JsonRpc
from joinmarket.support import get_log, joinmarket_alert, core_alert, debug_silence

# config = SafeConfigParser()
# config_location = 'joinmarket.cfg'

log = get_log()


class AttributeDict(object):
    """
    A class to convert a nested Dictionary into an object with key-values
    accessibly using attribute notation (AttributeDict.attribute) instead of
    key notation (Dict["key"]). This class recursively sets Dicts to objects,
    allowing you to recurse down nested dicts (like: AttributeDict.attr.attr)
    """
    def __init__(self, **entries):
        self.add_entries(**entries)

    def add_entries(self, **entries):
        for key, value in entries.items():
            if type(value) is dict: