oliverw / miningcore

Miningcore is a high-performance Mining Pool Software for Linux and Windows.
https://store.miningcore.pro
MIT License
730 stars 677 forks source link

Payout issue #350

Closed Jlonghi closed 6 years ago

Jlonghi commented 6 years ago

Description

Everything is working fine on the ethereum Ropsten testnet except for payouts. The first payout worked successfully and the second one and every single one after threw this:

[2018-05-30 19:55:28.9574] [E] [PayoutManager] [eth1] Payment processing failed System.InvalidOperationException: This NpgsqlTransaction has completed; it is no longer usable.
   at Npgsql.NpgsqlTransaction.CheckCompleted()
   at Npgsql.NpgsqlTransaction.<Rollback>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlTransaction.Rollback()
   at MiningCore.Extensions.ConnectionFactoryExtensions.<RunTxAsync>d__8.MoveNext() in /tmp/miningcore/src/MiningCore/Extensions/ConnectionFactoryExtensions.cs:line 221
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MiningCore.Payments.PayoutManager.<UpdatePoolBalancesAsync>d__12.MoveNext() in /tmp/miningcore/src/MiningCore/Payments/PayoutManager.cs:line 121
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MiningCore.Payments.PayoutManager.<ProcessPoolsAsync>d__11.MoveNext() in /tmp/miningcore/src/MiningCore/Payments/PayoutManager.cs:line 95    at Npgsql.NpgsqlTransaction.CheckCompleted()
   at Npgsql.NpgsqlTransaction.<Rollback>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlTransaction.Rollback()
   at MiningCore.Extensions.ConnectionFactoryExtensions.<RunTxAsync>d__8.MoveNext() in /tmp/miningcore/src/MiningCore/Extensions/ConnectionFactoryExtensions.cs:line 221
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MiningCore.Payments.PayoutManager.<UpdatePoolBalancesAsync>d__12.MoveNext() in /tmp/miningcore/src/MiningCore/Payments/PayoutManager.cs:line 121
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MiningCore.Payments.PayoutManager.<ProcessPoolsAsync>d__11.MoveNext() in /tmp/miningcore/src/MiningCore/Payments/PayoutManager.cs:line 95

Expected behavior

Payouts to succeed

Actual behavior

exception pasted above is thrown

Reproduces how often

Every payout

Version

Master branch

Additional Information

Jlonghi commented 6 years ago

Failed on an uncle block. I have keep uncles: false

Jlonghi commented 6 years ago

Some more information:

[2018-06-01 15:25:34.0205] [I] [eth1] [Ethereum Payout Handler] Unlocked block 3353885 worth 3.00058 ETH 
[2018-06-01 15:25:34.1648] [I] [eth1] [Ethereum Payout Handler] Fetching 1 uncles for block 3353840 
[2018-06-01 15:25:34.1659] [I] [eth1] [Ethereum Payout Handler] Fetched 1 uncles for block 3353840 
[2018-06-01 15:25:34.1659] [I] [eth1] [Ethereum Payout Handler] Fetching 1 uncles for block 3353866 
[2018-06-01 15:25:34.1659] [I] [eth1] [Ethereum Payout Handler] Fetched 1 uncles for block 3353866 
[2018-06-01 15:25:34.1659] [I] [eth1] [Ethereum Payout Handler] Unlocked uncle for block 3353866 at height 3353863 worth 1.875 ETH 
[2018-06-01 15:25:34.1659] [I] [eth1] [Ethereum Payout Handler] Fetching 1 uncles for block 3353866 
[2018-06-01 15:25:34.1659] [I] [eth1] [Ethereum Payout Handler] Fetched 1 uncles for block 3353866 
[2018-06-01 15:25:34.1659] [I] [eth1] [Ethereum Payout Handler] Unlocked uncle for block 3353866 at height 3353863 worth 1.875 ETH 
[2018-06-01 15:25:34.1716] [I] [PayoutManager] Processing payments for pool eth1, block 3353810 
[2018-06-01 15:25:34.2483] [I] [PPLNS Payment] Fetching page 0 of shares for pool eth1, block 3353810 
[2018-06-01 15:25:34.2791] [I] [PPLNS Payment] Balance-calculation for pool eth1, block 3353810 completed with accumulated score 2 (100%) 
[2018-06-01 15:25:34.2791] [I] [PPLNS Payment] Adding 2.6225 ETH to balance of 0xb9b90cdc6a0cab4b5fb4eadc632a78710761b860 for 10.69 G (10687359694.1834) shares for block 3353810 
[2018-06-01 15:25:34.3200] [I] [PPLNS Payment] 10.69 G (10687359694.18) shares contributed to a total payout of 2.6225 ETH (100.00% of block reward) to 1 addresses 
[2018-06-01 15:25:34.3544] [E] [PayoutManager] [eth1] Payment processing failed System.InvalidOperationException: This NpgsqlTransaction has completed; it is no longer usable.
   at Npgsql.NpgsqlTransaction.CheckCompleted()
   at Npgsql.NpgsqlTransaction.Rollback(Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlTransaction.Rollback()
   at MiningCore.Extensions.ConnectionFactoryExtensions.RunTxAsync(IConnectionFactory factory, Func`3 action, Boolean autoCommit, IsolationLevel isolation) in /tmp/miningcore/src/MiningCore/Extensions/ConnectionFactoryExtensions.cs:line 221
   at MiningCore.Payments.PayoutManager.UpdatePoolBalancesAsync(PoolConfig pool, IPayoutHandler handler, IPayoutScheme scheme) in /tmp/miningcore/src/MiningCore/Payments/PayoutManager.cs:line 123
   at MiningCore.Payments.PayoutManager.ProcessPoolsAsync() in /tmp/miningcore/src/MiningCore/Payments/PayoutManager.cs:line 97    at Npgsql.NpgsqlTransaction.CheckCompleted()
   at Npgsql.NpgsqlTransaction.Rollback(Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlTransaction.Rollback()
   at MiningCore.Extensions.ConnectionFactoryExtensions.RunTxAsync(IConnectionFactory factory, Func`3 action, Boolean autoCommit, IsolationLevel isolation) in /tmp/miningcore/src/MiningCore/Extensions/ConnectionFactoryExtensions.cs:line 221
   at MiningCore.Payments.PayoutManager.UpdatePoolBalancesAsync(PoolConfig pool, IPayoutHandler handler, IPayoutScheme scheme) in /tmp/miningcore/src/MiningCore/Payments/PayoutManager.cs:line 123
   at MiningCore.Payments.PayoutManager.ProcessPoolsAsync() in /tmp/miningcore/src/MiningCore/Payments/PayoutManager.cs:line 97
{
    "logging": {
        "level": "info",
        "enableConsoleLog": true,
        "enableConsoleColors": true,
        "logFile": "",
        "logBaseDirectory": "",
        "perPoolLogFile": false
    },
    "banning": {
        "manager": "integrated",
        "banOnJunkReceive": true,
        "banOnInvalidShares": false
    },
    "notifications": {
        "enabled": true,
        "email": {
            "host": "smtp.example.com",
            "port": 587,
            "user": "user",
            "password": "password",
            "fromAddress": "info@yourpool.org",
            "fromName": "support"
        },
        "admin": {
            "enabled": false,
            "emailAddress": "user@example.com",
            "notifyBlockFound": true
        }
    },
    "persistence": {
        "postgres": {
            "host": "127.0.0.1",
            "port": 5432,
            "user": "miningcore",
            "password": "*****",
            "database": "miningcore"
        }
    },
    "paymentProcessing": {
        "enabled": true,
        "interval": 120,
        "shareRecoveryFile": "recovered-shares.txt"
    },
    "api": {
      "enabled": true,
      "listenAddress": "0.0.0.0",
      "port": 4001
    },
    "pools": [{
        "id": "eth1",
        "enabled": true,
        "coin": {
            "type": "ETH"
        },
        "address": "0xacdc683aff5c7ef26e0565ea719bb7ac7da4ebee",
        "rewardRecipients": [{
                "type": "op",
                "address": "0xacdc683aff5c7ef26e0565ea719bb7ac7da4ebee",
                "percentage": 0
        }],
        "blockRefreshInterval": 100,
        "clientConnectionTimeout": 600,
        "banning": {
            "enabled": true,
            "time": 600,
            "invalidPercent": 50,
            "checkThreshold": 50
        },
        "ports": {
            "3073": {
                "listenAddress": "0.0.0.0",
                "difficulty": 1,
                "varDiff": {
                    "minDiff": 0.05,
                    "maxDiff": null,
                    "targetTime": 15,
                    "retargetTime": 90,
                    "variancePercent": 30
                }
            }
        },
        "daemons": [
            {
                "host": "127.0.0.1",
                "port": 8550,
                "user": "",
                "password": ""
            }
        ],
        "paymentProcessing": {
            "enabled": true,
            "minimumPayment": 0.01,
            "payoutScheme": "PPLNS",
            "payoutSchemeConfig": {
                "factor": 2.0
            },
            "coinbasePassword": "****",
        "keepUncles": true,
            "keepTransactionFees": false
        }
    }]
}
Konstantin35 commented 6 years ago

show parity settings

Jlonghi commented 6 years ago

Running in docker. Config file has chains=ropsten and the author address.

docker run -d -p 8185:8180 -p 8550:8545 -p 8551:8546 -p 30308:30303 -p 30308:30303/udp -v ~/eth-test-pass.txt:/root/pass.txt -v ~/.local/share/io.parity.ethereum/docker/:/root/.local/share/io.parity.ethereum/ --name eth-node-testnet -t parity/parity:stable --config /root/.local/share/io.parity.ethereum/config.toml --mode active --no-ui --no-dapps --no-ipc --jsonrpc-interface "0.0.0.0" --jsonrpc-threads 4 --jsonrpc-port 8545 --no-discovery --jsonrpc-apis "eth,net,web3,personal,parity,parity_pubsub,rpc" --cache-size 512 --logging info --ws-port 8546 --ws-interface all --base-path /root/.local/share/io.parity.ethereum/data --allow-ips all --jsonrpc-hosts all --db-compaction ssd --pruning fast --tracing off --unlock "0xacdc683aff5c7ef26e0565ea719bb7ac7da4ebee" --password /root/pass.txt

Konstantin35 commented 6 years ago

remove --unlock "0xacdc683aff5c7ef26e0565ea719bb7ac7da4ebee" --password /root/pass.txt

add to miningcore settings "daemons": [ { "host": "127.0.0.1", "port": 8550, "user": "", "password": "", "portWs": 8546 } ]

here information Configuration

Jlonghi commented 6 years ago

Thanks for the reply. Ill give that a shot

Jlonghi commented 6 years ago

Didn't fix it unfortunately. Still had the exception thrown on the second uncle block this time.

Konstantin35 commented 6 years ago

Here are my settings on ELLA parity --chain ellaism --no-discovery --no-ui --no-dapps --no-ipc --jsonrpc-interface 127.0.0.1 --jsonrpc-threads 4 --jsonrpc-port 8545 --jsonrpc-apis eth,net,web3,personal,parity,parity_pubsub,rpc --author 0x8b51127a10cec5ee67d52bda182c3e7c7922e27b --cache-size 512 --logging info --ws-port 18545 --ws-interface all everything works as it should

Jlonghi commented 6 years ago

Must be the ropsten testnet then.. I have everything the same as you.

Jlonghi commented 6 years ago

Update.. the pool works for ellaism.. with uncles. It must be a ropsten issue.

calvintam236 commented 6 years ago

My experience is that mining in testnets with parity always results in error for miningcore payouts.

Jlonghi commented 6 years ago

Actually after running ellasim for awhile i ended up running into that error. I added some debugging and narrowed down what it was doing. On Ropsten I found this

This code is in blockrepository.cs in the UpdateBlock function.

[2018-06-13 17:37:39.7637] [I] [BlockRepository] block attributes: Id 4043, poolId ropst-test, BlockHeight 3429202, status Confirmed, type uncle, reward 1.5, reward 1.5, effort , Confirmationprogress 1 
[2018-06-13 17:37:39.7839] [I] [BlockRepository] block attributes: Id 4044, poolId ropst-test, BlockHeight 3429202, status Confirmed, type uncle, reward 1.5, reward 1.5, effort , Confirmationprogress 1 

It would update one block (id 4043) then try to update block id 4044 but the block height already exists. This would cause the exception to be throw. For some reason my parity is giving two uncle blocks?

calvintam236 commented 6 years ago

Maybe @oliverw can give an insight?

oliverw commented 6 years ago

Support for this coin has been dropped a long time ago. Closing.

Jlonghi commented 6 years ago

Thanks