It looks like the vardiff stuff is handled by the share limiter on submission of the share. I am not sure why it would be in the subscribe method at all. If you think the rpc hasn't gotten the initial diff at this point, I can add in the same call with whatever is in session['difficulty']. I don't really understand why the prev_diff and (what seems like) the vardiff stuff was added there.