+ account_max_gap command
This commit is contained in:
parent
aeaffd620e
commit
84d97ab323
2 changed files with 27 additions and 8 deletions
|
@ -3125,7 +3125,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
response = yield self._render_response(out)
|
response = yield self._render_response(out)
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
|
|
||||||
@AuthJSONRPCServer.requires("wallet")
|
@requires("wallet")
|
||||||
def jsonrpc_account_balance(self, account_name=None, confirmations=6,
|
def jsonrpc_account_balance(self, account_name=None, confirmations=6,
|
||||||
include_reserved=False, include_claims=False):
|
include_reserved=False, include_claims=False):
|
||||||
"""
|
"""
|
||||||
|
@ -3168,6 +3168,28 @@ class Daemon(AuthJSONRPCServer):
|
||||||
raise Exception("'--include-claims' requires specifying an LBC account.")
|
raise Exception("'--include-claims' requires specifying an LBC account.")
|
||||||
return self.wallet.get_balances(confirmations)
|
return self.wallet.get_balances(confirmations)
|
||||||
|
|
||||||
|
@requires("wallet")
|
||||||
|
def jsonrpc_account_max_gap(self, account_name):
|
||||||
|
"""
|
||||||
|
Finds ranges of consecutive addresses that are unused and returns the length
|
||||||
|
of the longest such range: for change and receiving address chains. This is
|
||||||
|
useful to figure out ideal values to set for 'receiving_gap' and 'change_gap'
|
||||||
|
account settings.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
account_max_gap <account_name>
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--account=<account_name> : (str) account for which to get max gaps
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
(map) maximum gap for change and receiving addresses
|
||||||
|
"""
|
||||||
|
for account in self.wallet.accounts:
|
||||||
|
if account.name == account_name:
|
||||||
|
return account.get_max_gap()
|
||||||
|
raise Exception("Couldn't find an account named: '{}'.".format(account_name))
|
||||||
|
|
||||||
|
|
||||||
def loggly_time_string(dt):
|
def loggly_time_string(dt):
|
||||||
formatted_dt = dt.strftime("%Y-%m-%dT%H:%M:%S")
|
formatted_dt = dt.strftime("%Y-%m-%dT%H:%M:%S")
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import os
|
import os
|
||||||
import six
|
|
||||||
import json
|
import json
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
@ -16,16 +15,14 @@ from .transaction import Transaction
|
||||||
from .database import WalletDatabase # pylint: disable=unused-import
|
from .database import WalletDatabase # pylint: disable=unused-import
|
||||||
|
|
||||||
|
|
||||||
if six.PY3:
|
|
||||||
buffer = memoryview
|
|
||||||
|
|
||||||
|
|
||||||
class BackwardsCompatibleNetwork:
|
class BackwardsCompatibleNetwork:
|
||||||
def __init__(self, manager):
|
def __init__(self, manager):
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
|
||||||
def get_local_height(self):
|
def get_local_height(self):
|
||||||
return len(self.manager.ledgers.values()[0].headers)
|
for ledger in self.manager.ledgers.values():
|
||||||
|
assert isinstance(ledger, MainNetLedger)
|
||||||
|
return ledger.headers.height
|
||||||
|
|
||||||
def get_server_height(self):
|
def get_server_height(self):
|
||||||
return self.get_local_height()
|
return self.get_local_height()
|
||||||
|
@ -173,7 +170,7 @@ class LbryWalletManager(BaseWalletManager):
|
||||||
defer.returnValue(tx)
|
defer.returnValue(tx)
|
||||||
|
|
||||||
def _old_get_temp_claim_info(self, tx, txo, address, claim_dict, name, bid):
|
def _old_get_temp_claim_info(self, tx, txo, address, claim_dict, name, bid):
|
||||||
if isinstance(address, buffer):
|
if isinstance(address, memoryview):
|
||||||
address = str(address)
|
address = str(address)
|
||||||
return {
|
return {
|
||||||
"claim_id": hexlify(tx.get_claim_id(txo.position)).decode(),
|
"claim_id": hexlify(tx.get_claim_id(txo.position)).decode(),
|
||||||
|
|
Loading…
Reference in a new issue