Hmm, tried sending the fixed version to Bitcoin application in server mode, and got a false result. Tried the same with some other variation of the messages, and also got false-s.
This is the Getmemorypool data I received (ignoring all the transactions):
{'previousblockhash': '0000000020bcc87b08b88b6ccf1f79022bb2404b26e8fcec398fe323e93f2bc1', 'transactions': [], 'version': 1, 'coinbasevalue': 5005350000, 'time': 1332022461, 'bits': '1c2336a4'}
So, got this Getwork response:
00000001e93f2bc1398fe32326e8fcec2bb2404bcf1f790208b88b6c20bcc87b00000000b0bdf352aa835722693225753422bea517f9143755c2c705fad08617be75d1de4f65086e1c2336a462295f9f000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000
And tried calling the Bitcoin getmemorypool with the following parameters:
010000000000000020BCC87B08B88B6CCF1F79022BB2404B26E8FCEC398FE323E93F2BC1BE75D1DEFAD0861755C2C70517F914373422BEA569322575AA835722B0BDF3526E08654FA436231C9F5F29620101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF1D546865506961636875277E427B80F359164A5BC11171D7ED423A35EC7EFFFFFFFF0100F2052A01000000434104475876434DAB12C149E7DC68AA4AEF44B7DAD9BC9B90CB1C6751EAD47DE7BA3AC7AA10C6BCDEB6DC42C85BB7588BC114C6E47072E0264FB1C33B6FBD69E040F2AC00000000
01000000C12B3FE923E38F39ECFCE8264B40B22B02791FCF6C8BB8087BC8BC2000000000BE75D1DEFAD0861755C2C70517F914373422BEA569322575AA835722B0BDF3526E08654FA436231C9F5F29620101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF1D546865506961636875277E427B80F359164A5BC11171D7ED423A35EC7EFFFFFFFF0100F2052A01000000434104475876434DAB12C149E7DC68AA4AEF44B7DAD9BC9B90CB1C6751EAD47DE7BA3AC7AA10C6BCDEB6DC42C85BB7588BC114C6E47072E0264FB1C33B6FBD69E040F2AC00000000
010000000000000020BCC87B08B88B6CCF1F79022BB2404B26E8FCEC398FE323E93F2BC152F3BDB0225783AA75253269A5BE22343714F91705C7C2551786D0FADED175BE6E08654FA436231C9F5F29620101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF1D546865506961636875277E427B80F359164A5BC11171D7ED423A35EC7EFFFFFFFF0100F2052A01000000434104475876434DAB12C149E7DC68AA4AEF44B7DAD9BC9B90CB1C6751EAD47DE7BA3AC7AA10C6BCDEB6DC42C85BB7588BC114C6E47072E0264FB1C33B6FBD69E040F2AC00000000
01000000C12B3FE923E38F39ECFCE8264B40B22B02791FCF6C8BB8087BC8BC200000000052F3BDB0225783AA75253269A5BE22343714F91705C7C2551786D0FADED175BE6E08654FA436231C9F5F29620101000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF1D546865506961636875277E427B80F359164A5BC11171D7ED423A35EC7EFFFFFFFF0100F2052A01000000434104475876434DAB12C149E7DC68AA4AEF44B7DAD9BC9B90CB1C6751EAD47DE7BA3AC7AA10C6BCDEB6DC42C85BB7588BC114C6E47072E0264FB1C33B6FBD69E040F2AC00000000
And all of them returned false.
From what I understand, the proper brakedown should be this:
01000000
C12B3FE923E38F39ECFCE8264B40B22B02791FCF6C8BB8087BC8BC2000000000
52F3BDB0225783AA75253269A5BE22343714F91705C7C2551786D0FADED175BE
6E08654F
A436231C
9F5F2962
01
01000000
01
0000000000000000000000000000000000000000000000000000000000000000FFFFFFFF
1D
546865506961636875277E427B80F359164A5BC11171D7ED423A35EC7E
FFFFFFFF
01
00F2052A01000000
43
4104475876434DAB12C149E7DC68AA4AEF44B7DAD9BC9B90CB1C6751EAD47DE7BA3AC7AA10C6BCDEB6DC42C85BB7588BC114C6E47072E0264FB1C33B6FBD69E040F2AC
00000000
So I've tried every variant of previous hash and merkle root endianness. What I'm guessing the problem can be is:
-The Bitcoin client does not like handling getmemorypool
-I've made some error calculating the merkle root
-The nonce setting is wrong
-There is something wrong with the coinbase transaction