What is OP_CODESEPARATOR used for?

Looking at the Bitcoin source (https://github.com/bitcoin/bitcoin/blob/v0.9.3/src/script.cpp#L843-L847, specifically), I ran into the use of the OP_CODESEPARATOR. Am I right in interpreting this code that it is not always the case that the whole scriptPubKey is signed, but really just the part that is later than the most recent OP_CODESEPARATOR? What happens if an OP_IF causes an OP_CODESEPARATOR to be skipped?

It seems strange to me that the entire scriptPubKey isn’t used for signing in all cases, so I’m guessing there is some use case for this that I haven’t thought of. Does anyone know what this use case is?

I’ve read through this bitcointalk thread, but didn’t really find any conclusion there.

Sending bitcoins to same address

I am using the BitcoinJ API to create my wallet.
When I create a transaction, I provide the change address to which change should be sent.
For example: let there be 1 bitcoin at address A;
then I create a transaction to send 0.1 bitcoins to address B and the change (0.9 bitcoins) back to address A.

In the BitcoinJ wallet, I see that the change (0.9 bitcoins) is not received back. To try to fix that, I created a custom coin selector to explicitly select unconfirmed transactions which are generated by myself—but still I do not see the change (0.9 bitcoins) in my wallet.

This is the transaction view https://www.biteasy.com/testnet/transactions/db66d5058e5773f353447ffa2174a417867e9aa134113f01359576f5e6f2b4c6

And this is my wallet https://www.biteasy.com/testnet/addresses/mnj3589DHMoCyhxDSvWKubjkUoTenmrGkE.

According to my address on Biteasy, there is a balance of 4BTC,
but my BitcoinJ wallet shows only 0.069BTC

Now my question is: Why can’t I send return change to same address it is being sent from?

Input validation in transactions

I’m just writing a small essay about the basics of BTC and I ran into a small problem.

I know, that there are digital signatures in our bitcoins’ earlier transactions (our transaction inputs) and in the next owner’s public key. How can the system verify, if the input is really from our earlier output? We can just use a random (unspent) output from an earlier block, can’t we? I know that we are the next owner and our public key is in the transaction, but we can (and should) generate a a new public-private key for our next transaction, so the new private key won’t match our “old” public key… What is that thing I don’t know or understand?

Multiple coins on one server running MPOS/stratum

I’ve got an instance of MPOS and a stratum server running a single PeerCoin pool perfectly fine.

How do I go about adding a second pool to the same server?

I’ve tried to duplicate both the stratum server folders and the MPOS folders, then configure for a different coin. However, when when I browse to the other MPOS instance, for example www.mysite.com/MPOSSECONDSITE/public, it loads a blank page. What am I doing wrong?