forked from LBRYCommunity/lbry-sdk
renamed a bunch of wallet commands and split up the big account command
This commit is contained in:
parent
93d134f0ce
commit
1675cc4580
5 changed files with 614 additions and 565 deletions
76
CHANGELOG.md
76
CHANGELOG.md
|
@ -8,33 +8,63 @@ can and probably will change functionality and break backwards compatibility
|
||||||
at anytime.
|
at anytime.
|
||||||
|
|
||||||
## [Unreleased]
|
## [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
|
### 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
|
## [0.21.2] - 2018-08-23
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -314,24 +314,24 @@ class WalletComponent(Component):
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
super().__init__(component_manager)
|
super().__init__(component_manager)
|
||||||
self.wallet = None
|
self.wallet_manager = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def component(self):
|
def component(self):
|
||||||
return self.wallet
|
return self.wallet_manager
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_status(self):
|
def get_status(self):
|
||||||
if self.wallet:
|
if self.wallet_manager:
|
||||||
local_height = self.wallet.network.get_local_height()
|
local_height = self.wallet_manager.network.get_local_height()
|
||||||
remote_height = self.wallet.network.get_server_height()
|
remote_height = self.wallet_manager.network.get_server_height()
|
||||||
best_hash = yield self.wallet.get_best_blockhash()
|
best_hash = yield self.wallet_manager.get_best_blockhash()
|
||||||
defer.returnValue({
|
defer.returnValue({
|
||||||
'blocks': max(local_height, 0),
|
'blocks': max(local_height, 0),
|
||||||
'blocks_behind': max(remote_height - local_height, 0),
|
'blocks_behind': max(remote_height - local_height, 0),
|
||||||
'best_blockhash': best_hash,
|
'best_blockhash': best_hash,
|
||||||
'is_encrypted': self.wallet.wallet.use_encryption,
|
'is_encrypted': self.wallet_manager.wallet.use_encryption,
|
||||||
'is_locked': not self.wallet.is_wallet_unlocked,
|
'is_locked': not self.wallet_manager.is_wallet_unlocked,
|
||||||
})
|
})
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -339,14 +339,14 @@ class WalletComponent(Component):
|
||||||
log.info("Starting torba wallet")
|
log.info("Starting torba wallet")
|
||||||
storage = self.component_manager.get_component(DATABASE_COMPONENT)
|
storage = self.component_manager.get_component(DATABASE_COMPONENT)
|
||||||
lbryschema.BLOCKCHAIN_NAME = conf.settings['blockchain_name']
|
lbryschema.BLOCKCHAIN_NAME = conf.settings['blockchain_name']
|
||||||
self.wallet = LbryWalletManager.from_lbrynet_config(conf.settings, storage)
|
self.wallet_manager = LbryWalletManager.from_lbrynet_config(conf.settings, storage)
|
||||||
self.wallet.old_db = storage
|
self.wallet_manager.old_db = storage
|
||||||
yield self.wallet.start()
|
yield self.wallet_manager.start()
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def stop(self):
|
def stop(self):
|
||||||
yield self.wallet.stop()
|
yield self.wallet_manager.stop()
|
||||||
self.wallet = None
|
self.wallet_manager = None
|
||||||
|
|
||||||
|
|
||||||
class BlobComponent(Component):
|
class BlobComponent(Component):
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -111,7 +111,7 @@ class CommandTestCase(IntegrationTestCase):
|
||||||
|
|
||||||
def wallet_maker(component_manager):
|
def wallet_maker(component_manager):
|
||||||
self.wallet_component = WalletComponent(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
|
self.wallet_component._running = True
|
||||||
return self.wallet_component
|
return self.wallet_component
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class CommandTestCase(IntegrationTestCase):
|
||||||
#for component in skip:
|
#for component in skip:
|
||||||
# self.daemon.component_attributes.pop(component, None)
|
# self.daemon.component_attributes.pop(component, None)
|
||||||
await d2f(self.daemon.setup())
|
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
|
self.manager.old_db = self.daemon.storage
|
||||||
|
|
||||||
async def tearDown(self):
|
async def tearDown(self):
|
||||||
|
|
|
@ -50,10 +50,10 @@ def get_test_daemon(data_rate=None, generous=True, with_fee=False):
|
||||||
)
|
)
|
||||||
daemon = LBRYDaemon(component_manager=component_manager)
|
daemon = LBRYDaemon(component_manager=component_manager)
|
||||||
daemon.payment_rate_manager = OnlyFreePaymentsManager()
|
daemon.payment_rate_manager = OnlyFreePaymentsManager()
|
||||||
daemon.wallet = mock.Mock(spec=LbryWalletManager)
|
daemon.wallet_manager = mock.Mock(spec=LbryWalletManager)
|
||||||
daemon.wallet.wallet = mock.Mock(spec=Wallet)
|
daemon.wallet_manager.wallet = mock.Mock(spec=Wallet)
|
||||||
daemon.wallet.wallet.use_encryption = False
|
daemon.wallet_manager.wallet.use_encryption = False
|
||||||
daemon.wallet.network = FakeNetwork()
|
daemon.wallet_manager.network = FakeNetwork()
|
||||||
daemon.storage = mock.Mock(spec=SQLiteStorage)
|
daemon.storage = mock.Mock(spec=SQLiteStorage)
|
||||||
market_feeds = [BTCLBCFeed(), USDBTCFeed()]
|
market_feeds = [BTCLBCFeed(), USDBTCFeed()]
|
||||||
daemon.exchange_rate_manager = DummyExchangeRateManager(market_feeds, rates)
|
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(
|
metadata.update(
|
||||||
{"fee": {"USD": {"address": "bQ6BGboPV2SpTMEP7wLNiAcnsZiH8ye6eA", "amount": 0.75}}})
|
{"fee": {"USD": {"address": "bQ6BGboPV2SpTMEP7wLNiAcnsZiH8ye6eA", "amount": 0.75}}})
|
||||||
migrated = smart_decode(json.dumps(metadata))
|
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}}})
|
{"test": {'claim': {'value': migrated.claim_dict}}})
|
||||||
return daemon
|
return daemon
|
||||||
|
|
||||||
|
@ -135,8 +135,8 @@ class TestJsonRpc(unittest.TestCase):
|
||||||
mock_conf_settings(self)
|
mock_conf_settings(self)
|
||||||
util.resetTime(self)
|
util.resetTime(self)
|
||||||
self.test_daemon = get_test_daemon()
|
self.test_daemon = get_test_daemon()
|
||||||
self.test_daemon.wallet.is_first_run = False
|
self.test_daemon.wallet_manager.is_first_run = False
|
||||||
self.test_daemon.wallet.get_best_blockhash = noop
|
self.test_daemon.wallet_manager.get_best_blockhash = noop
|
||||||
|
|
||||||
def test_status(self):
|
def test_status(self):
|
||||||
d = defer.maybeDeferred(self.test_daemon.jsonrpc_status)
|
d = defer.maybeDeferred(self.test_daemon.jsonrpc_status)
|
||||||
|
|
Loading…
Reference in a new issue