From 98f9588d945d4c1f9ea082a75866ab3e9f43f542 Mon Sep 17 00:00:00 2001 From: Erik Zhang Date: Thu, 27 Oct 2016 22:29:50 +0800 Subject: [PATCH] fix bug; --- src/AntShares/Core/RegisterTransaction.cs | 2 +- .../Blockchains/LevelDB/LevelDBBlockchain.cs | 6 +++--- src/AntShares/Wallets/Wallet.cs | 2 +- src/AntShares/project.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/AntShares/Core/RegisterTransaction.cs b/src/AntShares/Core/RegisterTransaction.cs index 6c21465018..30baecd108 100644 --- a/src/AntShares/Core/RegisterTransaction.cs +++ b/src/AntShares/Core/RegisterTransaction.cs @@ -84,7 +84,7 @@ protected override void DeserializeExclusiveData(BinaryReader reader) if (Precision > 8) throw new FormatException(); if (AssetType == AssetType.Share && Precision != 0) throw new FormatException(); - if (Amount.GetData() % (long)Math.Pow(10, 8 - Precision) != 0) + if (Amount != -Fixed8.Satoshi && Amount.GetData() % (long)Math.Pow(10, 8 - Precision) != 0) throw new FormatException(); Issuer = ECPoint.DeserializeFrom(reader, ECCurve.Secp256r1); Admin = reader.ReadSerializable(); diff --git a/src/AntShares/Implementations/Blockchains/LevelDB/LevelDBBlockchain.cs b/src/AntShares/Implementations/Blockchains/LevelDB/LevelDBBlockchain.cs index 235b50175a..b0b6169658 100644 --- a/src/AntShares/Implementations/Blockchains/LevelDB/LevelDBBlockchain.cs +++ b/src/AntShares/Implementations/Blockchains/LevelDB/LevelDBBlockchain.cs @@ -622,10 +622,10 @@ private void Persist(Block block) { batch.Put(SliceBuilder.Begin(DataEntryPrefix.ST_QuantityIssued).Add(quantity.Key), (GetQuantityIssued(quantity.Key) + quantity.Value).GetData()); } - current_block_hash = block.Hash; - current_block_height = block.Hash == GenesisBlock.Hash ? 0 : current_block_height + 1; - batch.Put(SliceBuilder.Begin(DataEntryPrefix.SYS_CurrentBlock), SliceBuilder.Begin().Add(block.Hash).Add(current_block_height)); + batch.Put(SliceBuilder.Begin(DataEntryPrefix.SYS_CurrentBlock), SliceBuilder.Begin().Add(block.Hash).Add(block.Height)); db.Write(WriteOptions.Default, batch); + current_block_hash = block.Hash; + current_block_height = block.Height; } private void PersistBlocks() diff --git a/src/AntShares/Wallets/Wallet.cs b/src/AntShares/Wallets/Wallet.cs index 6132f12c21..16dfe5989a 100644 --- a/src/AntShares/Wallets/Wallet.cs +++ b/src/AntShares/Wallets/Wallet.cs @@ -117,7 +117,7 @@ public static Fixed8 CalculateClaimAmount(IEnumerable inputs) { Dictionary claimable = Blockchain.Default.GetUnclaimed(group.Key); if (claimable == null || claimable.Count == 0) - throw new ArgumentException(); + continue; foreach (TransactionInput claim in group) { if (!claimable.ContainsKey(claim.PrevIndex)) diff --git a/src/AntShares/project.json b/src/AntShares/project.json index 27cd843312..f69b3ce308 100644 --- a/src/AntShares/project.json +++ b/src/AntShares/project.json @@ -2,7 +2,7 @@ "authors": [ "The Antshares team" ], "copyright": "2015-2016 The Antshares team", "title": "AntShares", - "version": "1.1.0.4", + "version": "1.1.1.1", "buildOptions": { "allowUnsafe": true, "copyToOutput": {