| 1797 | } |
| 1798 | |
| 1799 | bool CDarkSendPool::IsCompatibleWithSession(int64_t nDenom, CTransaction txCollateral, std::string& strReason) { |
| 1800 | LogPrintf("CDarkSendPool::IsCompatibleWithSession - sessionDenom %d sessionUsers %d\n", sessionDenom, sessionUsers); |
| 1801 | |
| 1802 | if (!unitTest && !IsCollateralValid(txCollateral)) { |
| 1803 | if (fDebug) LogPrintf ("CDarkSendPool::IsCompatibleWithSession - collateral not valid!\n"); |
| 1804 | strReason = _("Collateral not valid."); |
| 1805 | return false; |
| 1806 | } |
| 1807 | |
| 1808 | if (sessionUsers < 0) sessionUsers = 0; |
| 1809 | |
| 1810 | if (sessionUsers == 0) { |
| 1811 | sessionDenom = nDenom; |
| 1812 | sessionUsers++; |
| 1813 | lastTimeChanged = GetTimeMillis(); |
| 1814 | entries.clear(); |
| 1815 | |
| 1816 | if (!unitTest) { |
| 1817 | //broadcast that I'm accepting entries, only if it's the first entry though |
| 1818 | CDarksendQueue dsq; |
| 1819 | dsq.nDenom = nDenom; |
| 1820 | dsq.vin = activeMasternode.vin; |
| 1821 | dsq.time = GetTime(); |
| 1822 | dsq.Sign(); |
| 1823 | dsq.Relay(); |
| 1824 | } |
| 1825 | |
| 1826 | UpdateState(POOL_STATUS_QUEUE); |
| 1827 | vecSessionCollateral.push_back(txCollateral); |
| 1828 | return true; |
| 1829 | } |
| 1830 | |
| 1831 | if ((state != POOL_STATUS_ACCEPTING_ENTRIES && state != POOL_STATUS_QUEUE) || sessionUsers >= GetMaxPoolTransactions()) { |
| 1832 | if ((state != POOL_STATUS_ACCEPTING_ENTRIES && state != POOL_STATUS_QUEUE)) strReason = _("Incompatible mode."); |
| 1833 | if (sessionUsers >= GetMaxPoolTransactions()) strReason = _("Masternode queue is full."); |
| 1834 | LogPrintf("CDarkSendPool::IsCompatibleWithSession - incompatible mode, return false %d %d\n", state != POOL_STATUS_ACCEPTING_ENTRIES, sessionUsers >= GetMaxPoolTransactions()); |
| 1835 | return false; |
| 1836 | } |
| 1837 | |
| 1838 | if (nDenom != sessionDenom) { |
| 1839 | strReason = _("No matching denominations found for mixing."); |
| 1840 | return false; |
| 1841 | } |
| 1842 | |
| 1843 | LogPrintf("CDarkSendPool::IsCompatibleWithSession - compatible\n"); |
| 1844 | |
| 1845 | sessionUsers++; |
| 1846 | lastTimeChanged = GetTimeMillis(); |
| 1847 | vecSessionCollateral.push_back(txCollateral); |
| 1848 | |
| 1849 | return true; |
| 1850 | } |
| 1851 | |
| 1852 | //create a nice string to show the denominations |
| 1853 | void CDarkSendPool::GetDenominationsToString(int nDenom, std::string& strDenom) { |
no test coverage detected