small defects from the last merge

This commit is contained in:
romanman 2014-06-06 19:50:12 +01:00
parent 9f70c014a1
commit 3380dff118
5 changed files with 37 additions and 13 deletions

View File

@ -79,16 +79,21 @@ public class AccountState {
}
public void incrementNonce(){
rlpEncoded = null;
this.nonce = nonce.add(BigInteger.ONE);
}
public void setCodeHash(byte[] codeHash){ this.codeHash = codeHash; }
public void setCodeHash(byte[] codeHash){
rlpEncoded = null;
this.codeHash = codeHash;
}
public BigInteger getBalance() {
return balance;
}
public void addToBalance(BigInteger value){
if (value.signum() != 0) rlpEncoded = null;
this.balance = balance.add(value);
}

View File

@ -93,9 +93,9 @@ public class Block {
RLPElement cummGas = ((RLPList)rlpTxReceipt).get(1);
RLPElement pstTxState = ((RLPList)rlpTxReceipt).get(2);
// TransactionReceipt txReceipt =
// new TransactionReceipt(tx, cummGas.getRLPData(), pstTxState.getRLPData());
// txReceiptList.add(txReceipt);
TransactionReceipt txReceipt =
new TransactionReceipt(tx, cummGas.getRLPData(), pstTxState.getRLPData());
txReceiptList.add(txReceipt);
}
this.header.setTxTrieRoot(txsState.getRootHash());
@ -227,6 +227,7 @@ public class Block {
toStringBuff.append(txReceipt.toString());
}
toStringBuff.append("\n ]");
return toStringBuff.toString();
}

View File

@ -196,6 +196,8 @@ public class BlockHeader {
private StringBuffer toStringBuff = new StringBuffer();
public String toString() {
toStringBuff.setLength(0);
toStringBuff.append(" parentHash=" + ByteUtil.toHexString(parentHash)).append("\n");
toStringBuff.append(" unclesHash=" + ByteUtil.toHexString(unclesHash)).append("\n");
toStringBuff.append(" coinbase=" + ByteUtil.toHexString(coinbase)).append("\n");

View File

@ -109,15 +109,16 @@ public class StateTest {
account_2.setCodeHash(HashUtil.sha3(codeData));
trie.update(Hex.decode("77045e71a7a2c50903d88e564cd72fab11e82051"), account_2.getEncoded());
trie.update(HashUtil.sha3(codeData), codeData);
// trie.update(HashUtil.sha3(codeData), codeData);
AccountState account_3 = new AccountState(BigInteger.ZERO, new BigInteger("6260000000000000"));
AccountState account_3 = new AccountState(BigInteger.ZERO, new BigInteger("3006260000000000000"));
trie.update(Hex.decode("4c5f4d519dff3c16f0d54b6866e256fbbbc1a600"), account_3.getEncoded());
System.out.println("" + Hex.toHexString(trie.getRootHash()));
System.out.println(Hex.toHexString(trie.getRootHash()));
// 69c21ff84a5af0b53b11c61110a16d6ad43dad37b3eb29ae8e88c936eb06456a
// block 1 stateHash=69c21ff84a5af0b53b11c61110a16d6ad43dad37b3eb29ae8e88c936eb06456a
// block 2 stateHash=f2ae210b7141ba737fc8e356d539874e57b4aa65a5072aebbf4c53fd4db77b55
}

View File

@ -2827,10 +2827,6 @@ public class VMTest {
/**
* todo:
*
* 2) MOD
* 3) SMOD
* 4) SLT
* 5) SGT
* 15) PREVHASH:
* 16) COINBASE:
* 17) TIMESTAMP:
@ -2848,3 +2844,22 @@ public class VMTest {
**/
/**
contract creation
-----------------
G_TRANSACTION = (500)
60016000546006601160003960066000f261778e600054 (115)
PUSH1 6001 (1)
PUSH1 6000 (1)
MSTORE 54 (1 + 1)
PUSH1 6006 (1)
PUSH1 6011 (1)
PUSH1 6000 (1)
CODECOPY 39 (1)
PUSH1 6006 (1)
PUSH1 6000 (1)
RETURN f2 (1)
61778e600054
*/