xaya / taurion_gsp

Taurion - A Fully Decentralised MMO built for the Xaya Platform.
https://taurion.io
GNU General Public License v3.0
23 stars 10 forks source link

Delay the effect of building config updates #192

Closed domob1812 closed 3 years ago

domob1812 commented 3 years ago

This implements #95: When a building owner updates the configuration (service and DEX fee), this no longer takes place immediately. Instead, it starts a new type of ongoing operation for a "delayed update", and only changes the building configuration after a certain number of blocks (120 on mainnet, 10 on regtest). This prevents frontrunning attacks against users of the building.

As a side effect, this also changes the game-state JSON format for the building configuration. Instead of returning dexfee and servicefee directly inside the building JSON, they are now wrapped into a new config sub-object (whose format is reused for the delayed-update ongoing operations). Fields are only present in there if they are actually set vs. being the default value of 0.