| t@@ -611,6 +611,10 @@ def parse_args():
parser = ArgumentParser(description='Electrum Personal Server daemon')
parser.add_argument('config_file',
help='configuration file (mandatory)')
+ parser.add_argument("--rescan", action="store_true", help="Start the " +
+ " rescan script instead")
+ parser.add_argument("-v", "--version", action="version", version=
+ "%(prog)s " + SERVER_VERSION_NUMBER)
return parser.parse_args()
#log for checking up/seeing your wallet, debug for when something has gone wrong
t@@ -682,6 +686,10 @@ def main():
logger.error("Wallet related RPC calls not found, looks like the " +
"bitcoin node was compiled with the disable wallet flag")
return
+
+ if opts.rescan:
+ rescan_script(logger, rpc)
+ return
import_needed, relevant_spks_addrs, deterministic_wallets = \
get_scriptpubkeys_to_monitor(rpc, config)
if import_needed:
t@@ -748,7 +756,25 @@ def search_for_block_height_of_date(datestr, rpc):
else:
return -1
-def rescan():
+def rescan_script(logger, rpc):
+ user_input = input("Enter earliest wallet creation date (DD/MM/YYYY) "
+ "or block height to rescan from: ")
+ try:
+ height = int(user_input)
+ except ValueError:
+ height = search_for_block_height_of_date(user_input, rpc)
+ if height == -1:
+ return
+ height -= 2016 #go back two weeks for safety
+
+ if input("Rescan from block height " + str(height) + " ? (y/n):") != 'y':
+ return
+ logger.info("Rescanning. . . for progress indicator see the bitcoin node's"
+ + " debug.log file")
+ rpc.call("rescanblockchain", [height])
+ logger.info("end")
+
+def rescan_main():
opts = parse_args()
try:
t@@ -763,6 +789,8 @@ def rescan():
logger, logfilename = logger_config(logger, config)
logger.info('Starting Electrum Personal Server rescan script')
logger.info('Logging to ' + logfilename)
+ logger.info("The seperate rescan script is deprecated, use " +
+ "`electrum-personal-server --rescan` instead.")
try:
rpc_u = config.get("bitcoin-rpc", "rpc_user")
rpc_p = config.get("bitcoin-rpc", "rpc_password")
t@@ -775,19 +803,4 @@ def rescan():
port = int(config.get("bitcoin-rpc", "port")),
user = rpc_u, password = rpc_p,
wallet_filename=config.get("bitcoin-rpc", "wallet_filename").strip())
- user_input = input("Enter earliest wallet creation date (DD/MM/YYYY) "
- "or block height to rescan from: ")
- try:
- height = int(user_input)
- except ValueError:
- height = search_for_block_height_of_date(user_input, rpc)
- if height == -1:
- return
- height -= 2016 #go back two weeks for safety
-
- if input("Rescan from block height " + str(height) + " ? (y/n):") != 'y':
- return
- logger.info("Rescanning. . . for progress indicator see the bitcoin node's"
- + " debug.log file")
- rpc.call("rescanblockchain", [height])
- logger.info("end")
+ rescan_script(logger, rpc) |
| t@@ -13,7 +13,7 @@ setup(
entry_points={
"console_scripts": [
"electrum-personal-server = electrumpersonalserver.server.common:main",
- "electrum-personal-server-rescan = electrumpersonalserver.server.common:rescan",
+ "electrum-personal-server-rescan = electrumpersonalserver.server.common:rescan_main",
]
},
package_data={"electrumpersonalserver": ["certs/*"]}, |