Fix for transaction process RLP and nonce update on block
This commit is contained in:
parent
b52da2cf4a
commit
2f73b98614
|
@ -97,12 +97,15 @@ public class Wallet {
|
|||
|
||||
for (Transaction tx : transactions){
|
||||
|
||||
|
||||
byte[] senderAddress = tx.sender();
|
||||
AddressState senderState = rows.get(Hex.toHexString(senderAddress));
|
||||
if (senderState != null){
|
||||
BigInteger value = new BigInteger(tx.getValue());
|
||||
|
||||
senderState.addToBalance(value.negate());
|
||||
|
||||
senderState.incrementTheNonce();
|
||||
walletUpdated = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class PayOutDialog extends JDialog {
|
|||
BigInteger value = new BigInteger(amountInput.getText());
|
||||
byte[] address = Hex.decode(receiverInput.getText());
|
||||
|
||||
byte[] senderPrivKey = HashUtil.sha3(addressState.getEcKey().getPrivKeyBytes());
|
||||
byte[] senderPrivKey = addressState.getEcKey().getPrivKeyBytes();
|
||||
|
||||
byte[] nonce = addressState.getNonce() == BigInteger.ZERO ?
|
||||
null : addressState.getNonce().toByteArray();
|
||||
|
@ -88,7 +88,6 @@ class PayOutDialog extends JDialog {
|
|||
}
|
||||
|
||||
peer.sendTransaction(tx);
|
||||
addressState.incrementTheNonce();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -788,8 +788,12 @@ public class RLP {
|
|||
|
||||
public static byte[] encodeElement(byte[] srcData) {
|
||||
|
||||
if (srcData == null){
|
||||
return new byte[] { (byte) 0x80 };
|
||||
if (srcData == null) {
|
||||
return new byte[]{(byte) 0x80};
|
||||
} if (srcData.length == 1 && srcData[0] < 0x80) {
|
||||
|
||||
return srcData;
|
||||
|
||||
} else if (srcData.length <= 0x37) {
|
||||
// length = 8X
|
||||
byte length = (byte) (OFFSET_SHORT_ITEM + srcData.length);
|
||||
|
|
Loading…
Reference in New Issue