Skip to content

Commit

Permalink
Merge #359: Improvements to wallet syncing and monitoring
Browse files Browse the repository at this point in the history
c654de0 Wallet and blockchain refactoring (AdamISZ)
  • Loading branch information
AdamISZ committed Oct 25, 2019
2 parents d421aea + c654de0 commit 9e6fb98
Show file tree
Hide file tree
Showing 40 changed files with 1,568 additions and 1,231 deletions.
3 changes: 2 additions & 1 deletion jmbase/jmbase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from .support import (get_log, chunks, debug_silence, jmprint,
joinmarket_alert, core_alert, get_password,
set_logging_level, set_logging_color)
set_logging_level, set_logging_color,
JM_WALLET_NAME_PREFIX)
from .commands import *

3 changes: 3 additions & 0 deletions jmbase/jmbase/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import logging
from getpass import getpass

# global Joinmarket constants
JM_WALLET_NAME_PREFIX = "joinmarket-wallet-"

from chromalog.log import (
ColorizingStreamHandler,
ColorizingFormatter,
Expand Down
14 changes: 14 additions & 0 deletions jmbitcoin/jmbitcoin/secp256k1_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import re
import os
import struct
# note, only used for non-cryptographic randomness:
import random
from jmbitcoin.secp256k1_main import *
from jmbitcoin.bech32 import *

Expand Down Expand Up @@ -871,3 +873,15 @@ def mktx(ins, outs, version=1, locktime=0):
txobj["outs"].append(outobj)
return serialize(txobj)

def make_shuffled_tx(ins, outs, deser=True, version=1, locktime=0):
""" Simple utility to ensure transaction
inputs and outputs are randomly ordered.
Can possibly be replaced by BIP69 in future
"""
random.shuffle(ins)
random.shuffle(outs)
tx = mktx(ins, outs, version=version, locktime=locktime)
if deser:
return deserialize(tx)
else:
return tx
5 changes: 3 additions & 2 deletions jmclient/jmclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
from .wallet import (Mnemonic, estimate_tx_fee, WalletError, BaseWallet, ImportWalletMixin,
BIP39WalletMixin, BIP32Wallet, BIP49Wallet, LegacyWallet,
SegwitWallet, SegwitLegacyWallet, UTXOManager,
WALLET_IMPLEMENTATIONS, make_shuffled_tx)
WALLET_IMPLEMENTATIONS)
from .storage import (Argon2Hash, Storage, StorageError,
StoragePasswordError, VolatileStorage)
from .cryptoengine import BTCEngine, BTC_P2PKH, BTC_P2SH_P2WPKH, EngineError
from .configure import (
load_program_config, get_p2pk_vbyte, jm_single, get_network,
validate_address, get_irc_mchannels, get_blockchain_interface_instance,
get_p2sh_vbyte, set_config, is_segwit_mode, is_native_segwit_mode)
from .blockchaininterface import (BlockchainInterface, sync_wallet,
from .blockchaininterface import (BlockchainInterface,
RegtestBitcoinCoreInterface, BitcoinCoreInterface)
from .electruminterface import ElectrumInterface
from .client_protocol import (JMTakerClientProtocol, JMClientProtocolFactory,
Expand All @@ -46,6 +46,7 @@
wallet_tool_main, wallet_generate_recover_bip39, open_wallet,
open_test_wallet_maybe, create_wallet, get_wallet_cls, get_wallet_path,
wallet_display, get_utxos_enabled_disabled)
from .wallet_service import WalletService
from .maker import Maker, P2EPMaker
from .yieldgenerator import YieldGenerator, YieldGeneratorBasic, ygmain
# Set default logging handler to avoid "No handler found" warnings.
Expand Down
Loading

0 comments on commit 9e6fb98

Please sign in to comment.