commerceblock / federation

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

inflation robustness #12

Closed nkostoulas closed 5 years ago

nkostoulas commented 5 years ago

Currently the only condition to do inflation is if height % self.period == 0, which means that if inflation fails then it is skipped until the next period. We should add a mechanism that checks if inflation succeeded and if not then attempt to do it again.

Proposes changes:

With these changes each producer gets a turn to check that inflation has happened and if all agree then this check is postponed until the next inflation round.

There is a small complication where a producer exceeds the period time of 1 minute in the case that signing and sending these inflation transactions takes too long. Then it is possible that the second producer creates these again, while the first producer is still sending them. Ideally per #9 we should stop inflation if that happens but this is a bigger problem anyway which will require a very large number of assets in the system, far in the future.

tomt1664 commented 5 years ago

The best way I can think of to determine if the reissuance txs have confirmed (without knowing any of the asset details or the reissuance txids) is to look at the age of the reissuance token UTXOs (via listunspent). If any reissuance token has more confirmations than the number of blocks since height % self.period == 0, the asset has not been reissued.

I am in the process of adding the three changes you suggest - if all the assets haven't been inflated, the reissuance transactions are attempted again. This is repeated a number of times (within the 60 blocks), after which the daemon will terminate.

tomt1664 commented 5 years ago

f742ce141591f52eb90274f804fb181685a14d35