commerceblock / federation

Federation client for Ocean signing nodes.
MIT License
4 stars 4 forks source link

inflation: crashes for small inflation period #28

Open nkostoulas opened 4 years ago

nkostoulas commented 4 years ago
        elif self.inconf == 0 and height % self.period > 2 and height % self.period < self.period/2:
            riconf = self.confirm_reissuance_txs(ocean, height)
            self.logger.info("confirmed: "+str(riconf)+" node "+str(self.my_id))
            if riconf:
                self.inconf = 1
            else:
                #attempt reissuance again
                txs = self.get_reissuance_txs(ocean, height)
                self.inconf = 0
                if txs == None:
                    self.logger.warning("could not create reissuance txs on retry")
                    return None
        # If reissuance still not confirmed after 30 minutes (period/2) then stop
        elif self.inconf == 0 and height % self.period > self.period/2:
            raise Exception("FATAL: could not issue inflation transactions")

This will never confirm issuances and always raise an Exception for period values 1..7.

Further issue:

                        if unspent["confirmations"] > self.period/3:
                            self.logger.warning("Warning: reissuance failure - unspent reissuance token output: ")
                            self.logger.warning(unspent)

Period values 8..11 also unusable.

nkostoulas commented 4 years ago

Also @tomt1664 any reason why we check for confirmation at least 2 blocks after the issuance period instead of immediately?

tomt1664 commented 4 years ago

With the current protocol, the reissuance transactions are confirmed in block N + 2 if the transactions are initiated at blockheight N. I think the check should be done >= N+2 instead of > N+2.