Chia-Network / pool-reference

Reference python implementation of Chia pool operations for pool operators
Apache License 2.0
439 stars 197 forks source link

[BUG] Pool can run out of available balance because of low pool fee #9

Open ByronAP opened 3 years ago

ByronAP commented 3 years ago

Having the pool fee hardcoded presents an issue where if lots of miners are participating the pool can run out of funds.

If the total transaction fees + miner rewards > block reward (this would be extreme and probably a flood case) or total transaction fees > pool fee.

Instead the fee should be a multi part calculation.

The pool takes a flat fee (or percentage of reward) and then the total cost for transaction fees is calculated by the number of transactions required, then the remaining balance is what is divided up into the transaction amounts. Well or something along those lines anyway...

ByronAP commented 3 years ago

https://github.com/Chia-Network/pool-reference/blob/76615791f64a9afaad856641ed069f9f955c622f/pool.py#L68

https://github.com/Chia-Network/pool-reference/blob/76615791f64a9afaad856641ed069f9f955c622f/pool.py#L257

https://github.com/Chia-Network/pool-reference/blob/76615791f64a9afaad856641ed069f9f955c622f/pool.py#L395

mariano54 commented 3 years ago

This has been disabled for the time being.

forReason commented 3 years ago

@ByronAP wouldn't you normally substract the pool fee from the earnings whereas you substract the transaction fee from the actual payout of the Farmer/Miner?

ByronAP commented 3 years ago

@ByronAP wouldn't you normally substract the pool fee from the earnings whereas you substract the transaction fee from the actual payout of the Farmer/Miner?

Since the payout is 'share' based that gets reset at payout not taking the fees ahead of time could/would mean some payees can run into an issue where the payment for a valid but non-substantial amount of 'shares' calculates to a negative