Minor improve:

+ ProgramPlayDialog rollback changes
+ DataWord all zeroes care
This commit is contained in:
romanman 2014-06-15 20:50:53 +01:00
parent 63c9405c19
commit ea3372c4f5
3 changed files with 8 additions and 5 deletions

View File

@ -357,7 +357,7 @@ class ContractCallDialog extends JDialog implements MessageAwareDialog{
WorldManager.instance.detaildDB.get(contractAddress);
ContractDetails contractDetails = null;
if (contractDetailsB.length > 0)
if (contractDetailsB != null && contractDetailsB.length > 0)
contractDetails = new ContractDetails(contractDetailsB);
Transaction tx = createTransaction();

View File

@ -51,13 +51,14 @@ public class ProgramPlayDialog extends JPanel implements ActionListener,
ProgramInvokeFactory.createProgramInvoke(tx, lastBlock, contractDetails,
trackDetailDB, trackChainDb, trackStateDB));
program.addListener(this);
program.fullTrace();
vm.play(program);
trackDetailDB.rollbackTrack();
trackChainDb.rollbackTrack();
trackStateDB.rollbackTrack();
program.addListener(this);
program.fullTrace();
vm.play(program);
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

View File

@ -160,12 +160,14 @@ public class ByteUtil {
if (data == null) return null;
int firstNonZero = 0;
for (int i = 0; i < data.length; ++i)
int i = 0;
for (i = 0; i < data.length; ++i)
if (data[i] != 0){
firstNonZero = i;
break;
}
if (i == data.length) return new byte[1];
if (firstNonZero == 0) return data;
byte[] result = new byte[data.length - firstNonZero];