From 24c3ed1d2cf1f18bd813c91a8ba5613ea3ebe2a5 Mon Sep 17 00:00:00 2001 From: romanman Date: Fri, 4 Jul 2014 18:07:46 +0100 Subject: [PATCH] Transaction layer: + apply wire received transaction + resolve pending transaction saved by the GUI dialog --- .../src/main/java/org/ethereum/manager/WorldManager.java | 3 ++- .../org/ethereum/net/client/EthereumProtocolHandler.java | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java b/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java index 031e019f..04d6ef08 100644 --- a/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java +++ b/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java @@ -113,7 +113,8 @@ public class WorldManager { BigInteger gasDebit = tx.getTotalGasValueDebit(); // The coinbase get the gas cost - repository.addBalance(coinbase, gasDebit); + if (coinbase != null) + repository.addBalance(coinbase, gasDebit); byte[] contractAddress; diff --git a/ethereumj-core/src/main/java/org/ethereum/net/client/EthereumProtocolHandler.java b/ethereumj-core/src/main/java/org/ethereum/net/client/EthereumProtocolHandler.java index ece76d7b..9e9ad304 100644 --- a/ethereumj-core/src/main/java/org/ethereum/net/client/EthereumProtocolHandler.java +++ b/ethereumj-core/src/main/java/org/ethereum/net/client/EthereumProtocolHandler.java @@ -12,6 +12,7 @@ import java.util.Timer; import java.util.TimerTask; import org.ethereum.core.Block; +import org.ethereum.core.Transaction; import org.ethereum.manager.MainData; import org.ethereum.manager.WorldManager; import org.ethereum.net.Command; @@ -202,6 +203,10 @@ public class EthereumProtocolHandler extends ChannelInboundHandlerAdapter { RLPList rlpList = RLP.decode2(payload); TransactionsMessage transactionsMessage = new TransactionsMessage(rlpList); + List txList = transactionsMessage.getTransactions(); + for(Transaction tx : txList) + WorldManager.getInstance().applyTransaction(tx, null); + logger.info(transactionsMessage.toString()); if (peerListener != null) peerListener.console(transactionsMessage.toString()); }