do a sanity check to see if we have remote height, use remote height instead of local height when auto renewing

This commit is contained in:
Kay Kurokawa 2017-12-04 17:16:59 -05:00 committed by Jack Robison
parent bfbecd9196
commit 7e93ea8d97
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF

View file

@ -299,8 +299,11 @@ class Daemon(AuthJSONRPCServer):
# auto renew is turned off if 0 or some negative number
if self.auto_renew_claim_height_delta < 1:
defer.returnValue(None)
if not self.session.wallet.network.get_remote_height():
log.warning("Failed to get remote height, aborting auto renew")
defer.returnValue(None)
log.debug("Renewing claim")
h = self.session.wallet.network.get_local_height() + self.auto_renew_claim_height_delta
h = self.session.wallet.network.get_remote_height() + self.auto_renew_claim_height_delta
results = yield self.session.wallet.claim_renew_all_before_expiration(h)
for outpoint, result in results.iteritems():
if result['success']: