charge the collateral randomly - Darksend is completely free, to pay miners we randomly pay the collateral of users.
| 758 | // charge the collateral randomly |
| 759 | // - Darksend is completely free, to pay miners we randomly pay the collateral of users. |
| 760 | void CDarkSendPool::ChargeRandomFees() { |
| 761 | if (fMasterNode) { |
| 762 | int i = 0; |
| 763 | |
| 764 | for (const CTransaction& txCollateral : vecSessionCollateral) { |
| 765 | int r = rand() % 1000; |
| 766 | |
| 767 | /* |
| 768 | Collateral Fee Charges: |
| 769 | |
| 770 | Being that DarkSend has "no fees" we need to have some kind of cost associated |
| 771 | with using it to stop abuse. Otherwise it could serve as an attack vector and |
| 772 | allow endless transaction that would bloat Lux and make it unusable. To |
| 773 | stop these kinds of attacks 1 in 50 successful transactions are charged. This |
| 774 | adds up to a cost of 0.002Lux per transaction on average. |
| 775 | */ |
| 776 | if (r <= 20) { |
| 777 | LogPrintf("CDarkSendPool::ChargeRandomFees -- charging random fees. %u\n", i); |
| 778 | |
| 779 | CWalletTx wtxCollateral = CWalletTx(pwalletMain, txCollateral); |
| 780 | |
| 781 | // Broadcast |
| 782 | if (!wtxCollateral.AcceptToMemoryPool(true)) { |
| 783 | // This must not fail. The transaction has already been signed and recorded. |
| 784 | LogPrintf("CDarkSendPool::ChargeRandomFees() : Error: Transaction not valid"); |
| 785 | } |
| 786 | wtxCollateral.RelayWalletTransaction(); |
| 787 | } |
| 788 | } |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | // |
| 793 | // Check for various timeouts (queue objects, darksend, etc) |
nothing calls this directly
no test coverage detected