Skip to content

Commit

Permalink
Proper fix for TaPos
Browse files Browse the repository at this point in the history
  • Loading branch information
xeroc committed Jan 11, 2022
1 parent 20d69fd commit e228130
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions graphenecommon/transactionbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def __init__(self, tx={}, proposer=None, **kwargs):
self._require_reconstruction = True
self.set_fee_asset(kwargs.get("fee_asset", None))
self.set_expiration(kwargs.get("expiration", self.blockchain.expiration)) or 30
self.ref_block_time = None

def set_expiration(self, p):
self.expiration = p
Expand Down Expand Up @@ -402,9 +403,13 @@ def constructTx(self):
or 30 # defaults to 30 seconds
)
now = datetime.now()
if not self.get("ref_block_num") or now > self.get("ref_block_time") + datetime.timedelta(days=1) :
if (
not self.get("ref_block_num")
or not self.ref_block_time
or now > self.ref_block_time + timedelta(days=1)
):
ref_block_num, ref_block_prefix = self.get_block_params()
ref_block_time = now
self.ref_block_time = now
else:
ref_block_num = self["ref_block_num"]
ref_block_prefix = self["ref_block_prefix"]
Expand Down

0 comments on commit e228130

Please sign in to comment.