mm works really smooth so far, unfortunately the stale rate has dramatically increased from 0.3% to 3.3%. Do you only deem shares as valid when BTC + NMC results are up2date results? Only main chain would be enough imo if true.
I was just about to ask about this. Is anyone else seeing higher stale rates? From what I've heard it's only cgminer clients that are getting it. Any info people can report back will be helpful.
There's a numbers of issues at play here I think...
1/ There is a fundamental design clash between longpolling and merged mining. Basically it works like this: When there is a double block change (i.e. btc and nmc solved by one solution) the daemons won't see the new block at exactly the same time. From what I've seen a delay of around a 1-2 seconds is not unusual. What happens then is that one chain advances to the next block. PSJ checks the other chains to see if they've updated, sees they haven't so starts sending out LPs. Before the miner receives the LP and established a new LP connection the second chain advances so PSJ starts sending out another batch of LP's. Those miners who haven't got their new LP connection registered in time miss out.
2/ cgminer may be a bit too clever for it's own good. It does it's own checks on whether work is valid and I presume it uses prev_block_hash to check or maybe the X-Blocknum header. If an NMC block is found but it isn't a BTC solution then the pseudo block number will advance but the X-Blocknum header (which is for BTC block in psj) and the prev_block_hash won't change. So cgminer may think it's the same block and carry on using it's cached work.
3/ The rules for accepting a 'partially stale' share are not defined. If NMC block advances the previous work can still produce a valid BTC block although it will be rejected by the NMC daemon. The default behaviour is if it's not the current block (block in psj is now defined as a pseudoblocknum which is sum of all chain's blocknums) reject it as stale. This may have to change but I need some consensus from pool ops on the what the correct behaviour should be. I'm not going to code every option under the sun coz I'm little bit sick of merged mining TBH.
4/ The code for detecting and switching to new blocks is still pretty raw. It's possible the 'fireBlockChange' sequence is happening more often that it should which would put valid shares into the stale list. I don't know if this is the case but the solution 3/ contains the fix for this issue if it exists...