andelf / tronpy

TRON Python Client Library.
MIT License
204 stars 96 forks source link

|ERROR| Transaction expired #56

Closed loss-and-quick closed 2 years ago

loss-and-quick commented 2 years ago

When I try to send a transaction, the script shows that the transaction has expired and nothing helps me(at async version same error)

def transfer(self,dist_address: str,amount: float=0.0,memo: str="",fee: float=0.0)->dict:
        """Transfer trx to another wallet"""
        while True:
            try:
                txn =(self.blockchain.trx.transfer(self.address, dist_address, int(amount*1_000_000))
                #.fee_limit(int(fee*1_000_000))
                #.with_owner(self.address)
                .build()
                .sign(self.priv_key)
                .broadcast()

                ).wait(timeout=60)
                if  'id' in txn.keys() and txn['id']:
                   return True,txn['id']

            except Exception as e:
                print(e)
                time.sleep(2)
                continue
loss-and-quick commented 2 years ago

https://github.com/andelf/tronpy/issues/46#issue-1205465866 this helped me I set exparation to current_timestamp()+24 * 3600 * 1000