OK fixing that, here it is here where it should be.
... and now I'll ask an evil question coz I'm curious about it ...
I added the code that did network block detection in cgminer.
It reports "BLOCK!" on BOTH Accepted and Rejected shares.
I've wondered in the past if anyone has ever had a Rejected "BLOCK!"
i.e. you found a block, but you were JUST unlucky enough to find it in the time frame where it would be Rejected
( of course people have, but they'd need to keep their logs and check them ... I do keep all my logs and sometimes check them Cheesy )
They should be rare but also easy to calculate how often you should get them ...
The Rejection rate of your shares is a percentage.
That Rejection rate is also the % of blocks you find that should also be a Rejected "BLOCK!"
... now for a code change suggestion ...
So if you get 10% of your shares rejected then 10% of the blocks you find should also be rejected ....................
However ........... of that 10% that get rejected, 98.3% of them would be accepted by the bitcoin block chain but are invalid for the share chain and are thus thrown away .............
(I also wonder if this is a factor in the luck discussion - but I've no idea if it is)
Yeah I think there should be an exception in the code to allow rejected shares, that match this circumstance, and enable support for the exception in the share chain
i.e. if you get a Rejected BLOCK! it should make it all the way to the bitcoind and then it's up to bitcoind to reject it if it was a real block chain LP (not a P2Pool share chain LP)
Of course if this was implemented: it would also mean that everyone mining with cgminer on P2Pool should enable submit stale
(and also P2Pool should tell all miners to submit stale shares)
If a share is DOA or orphan it will still count as a real block. If you look at the source in main.got_response(header, request) the first thing it does is check if it is a real block. Only after that does it bother to check for DOA. CGminer will submit dead shares if you use --submit_stale, or if you are running a fairly recent version it will do this automatically. If you are using an old version of cgminer, and not using --submit_stale, then you could discard a valid block before it even reaches P2Pool.