renamed a bunch of wallet commands and split up the big account command

This commit is contained in:
Lex Berezhny 2018-08-25 23:20:43 -04:00
parent 93d134f0ce
commit 1675cc4580
5 changed files with 614 additions and 565 deletions

View file

@ -8,33 +8,63 @@ can and probably will change functionality and break backwards compatibility
at anytime.
## [Unreleased]
Python 3 upgrade of the entire code base and switching to a brand new wallet
implementation are the major changes in this release.
### Security
* Upgraded `cryptography` package.
*
* upgraded `cryptography` package.
### Fixed
*
*
### API
* unified all command line executables into a single `lbrynet` executable.
* deprecated `daemon_stop` command, use `stop` instead.
* deprecated `wallet_balance` command, use `account_balance` instead.
* deprecated `wallet_unlock` command, use `account_unlock` instead.
* deprecated `wallet_decrypt` command, use `account_decrypt` instead.
* deprecated `wallet_encrypt` command, use `account_encrypt` instead.
* deprecated `wallet_prefill_addresses` command, use `account_fund` instead.
* deprecated `wallet_list` command, use `address_list` instead.
* deprecated `wallet_is_address_mine` command, use `address_is_mine` instead.
* deprecated `wallet_public_key` command, use `address_public_key` instead.
* deprecated `wallet_new_address` command, use `address_generate` instead.
* deprecated `wallet_unused_address` command, use `address_unused` instead.
* added `account_list` command to list accounts including their balance.
* added `account_add` command to add a previously created account from seed or private key.
* added `account_create` command to generate a new account.
* added `account_remove` command to remove an account from wallet.
* added `account_set` command to change a setting on an account.
* added `account_balance` command to get just the account balance.
* added `account_unlock` command to unlock an account.
* added `account_encrypt` command to encrypt an account.
* added `account_decrypt` command to decrypt an account.
* added `account_fund` command to move funds between or within an account in various ways.
* added `account_max_address_gap` command to find large gaps of unused addresses.
* added `address_list` command to list addresses.
* added `address_is_mine` command to check if an address is one of your addresses.
* added `address_public_key` command to get public key of an address.
* added `address_generate` command to generate a new address.
* added `address_unused` command to get existing or generate a new unused address.
* removed `send_amount_to_address` command previously marked as deprecated
* removed `channel_list_mine` command previously marked as deprecated
* removed `get_availability` command previously marked as deprecated
### Deprecated
### Wallet
* changed to a new wallet implementation: torba.
* changed wallet file format to support multiple accounts in one wallet.
* moved transaction data from wallet file into an sqlite database.
* changed channel certificates to be keyed by txid:nout instead of claim_id which
makes it possible to recover old certificates.
### DHT
* Extensive internal changes as a result of porting to Python 3.
### P2P & File Manager
* Extensive internal changes as a result of porting to Python 3.
### Database
*
### Reflector
*
*
### Changed
* Ported to Python 3 without backwards compatibility with Python 2.
* Switched to a brand new wallet implementation: torba.
* Format of wallet has changed to support multiple accounts in one wallet.
### Added
* `fund` command, used to move funds between or within an account in various ways.
* `max_address_gap` command, for finding large gaps of unused addresses
* `balance` command, a more detailed version `wallet_balace` which includes all accounts.
* `account` command, adding/deleting/modifying accounts including setting the default account.
### Removed
* `send_amount_to_address` command, which was previously marked as deprecated
*
## [0.21.2] - 2018-08-23
### Fixed

View file

@ -314,24 +314,24 @@ class WalletComponent(Component):
def __init__(self, component_manager):
super().__init__(component_manager)
self.wallet = None
self.wallet_manager = None
@property
def component(self):
return self.wallet
return self.wallet_manager
@defer.inlineCallbacks
def get_status(self):
if self.wallet:
local_height = self.wallet.network.get_local_height()
remote_height = self.wallet.network.get_server_height()
best_hash = yield self.wallet.get_best_blockhash()
if self.wallet_manager:
local_height = self.wallet_manager.network.get_local_height()
remote_height = self.wallet_manager.network.get_server_height()
best_hash = yield self.wallet_manager.get_best_blockhash()
defer.returnValue({
'blocks': max(local_height, 0),
'blocks_behind': max(remote_height - local_height, 0),
'best_blockhash': best_hash,
'is_encrypted': self.wallet.wallet.use_encryption,
'is_locked': not self.wallet.is_wallet_unlocked,
'is_encrypted': self.wallet_manager.wallet.use_encryption,
'is_locked': not self.wallet_manager.is_wallet_unlocked,
})
@defer.inlineCallbacks
@ -339,14 +339,14 @@ class WalletComponent(Component):
log.info("Starting torba wallet")
storage = self.component_manager.get_component(DATABASE_COMPONENT)
lbryschema.BLOCKCHAIN_NAME = conf.settings['blockchain_name']
self.wallet = LbryWalletManager.from_lbrynet_config(conf.settings, storage)
self.wallet.old_db = storage
yield self.wallet.start()
self.wallet_manager = LbryWalletManager.from_lbrynet_config(conf.settings, storage)
self.wallet_manager.old_db = storage
yield self.wallet_manager.start()
@defer.inlineCallbacks
def stop(self):
yield self.wallet.stop()
self.wallet = None
yield self.wallet_manager.stop()
self.wallet_manager = None
class BlobComponent(Component):

File diff suppressed because it is too large Load diff

View file

@ -111,7 +111,7 @@ class CommandTestCase(IntegrationTestCase):
def wallet_maker(component_manager):
self.wallet_component = WalletComponent(component_manager)
self.wallet_component.wallet = self.manager
self.wallet_component.wallet_manager = self.manager
self.wallet_component._running = True
return self.wallet_component
@ -131,7 +131,7 @@ class CommandTestCase(IntegrationTestCase):
#for component in skip:
# self.daemon.component_attributes.pop(component, None)
await d2f(self.daemon.setup())
self.daemon.wallet = self.wallet_component.wallet
self.daemon.wallet_manager = self.wallet_component.wallet
self.manager.old_db = self.daemon.storage
async def tearDown(self):

View file

@ -50,10 +50,10 @@ def get_test_daemon(data_rate=None, generous=True, with_fee=False):
)
daemon = LBRYDaemon(component_manager=component_manager)
daemon.payment_rate_manager = OnlyFreePaymentsManager()
daemon.wallet = mock.Mock(spec=LbryWalletManager)
daemon.wallet.wallet = mock.Mock(spec=Wallet)
daemon.wallet.wallet.use_encryption = False
daemon.wallet.network = FakeNetwork()
daemon.wallet_manager = mock.Mock(spec=LbryWalletManager)
daemon.wallet_manager.wallet = mock.Mock(spec=Wallet)
daemon.wallet_manager.wallet.use_encryption = False
daemon.wallet_manager.network = FakeNetwork()
daemon.storage = mock.Mock(spec=SQLiteStorage)
market_feeds = [BTCLBCFeed(), USDBTCFeed()]
daemon.exchange_rate_manager = DummyExchangeRateManager(market_feeds, rates)
@ -79,7 +79,7 @@ def get_test_daemon(data_rate=None, generous=True, with_fee=False):
metadata.update(
{"fee": {"USD": {"address": "bQ6BGboPV2SpTMEP7wLNiAcnsZiH8ye6eA", "amount": 0.75}}})
migrated = smart_decode(json.dumps(metadata))
daemon._resolve = daemon.wallet.resolve = lambda *_: defer.succeed(
daemon._resolve = daemon.wallet_manager.resolve = lambda *_: defer.succeed(
{"test": {'claim': {'value': migrated.claim_dict}}})
return daemon
@ -135,8 +135,8 @@ class TestJsonRpc(unittest.TestCase):
mock_conf_settings(self)
util.resetTime(self)
self.test_daemon = get_test_daemon()
self.test_daemon.wallet.is_first_run = False
self.test_daemon.wallet.get_best_blockhash = noop
self.test_daemon.wallet_manager.is_first_run = False
self.test_daemon.wallet_manager.get_best_blockhash = noop
def test_status(self):
d = defer.maybeDeferred(self.test_daemon.jsonrpc_status)