From f1f81400490d722800599d9112e0b8e91a2b7d30 Mon Sep 17 00:00:00 2001 From: Erik Zhang Date: Fri, 21 Jul 2017 15:55:28 +0800 Subject: [PATCH] set minimum fee for contract to 1 gas --- neo-gui/UI/InvokeContractDialog.cs | 2 +- neo-gui/UI/MainForm.cs | 9 ++++++++- neo-gui/UI/VotingDialog.cs | 6 ++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/neo-gui/UI/InvokeContractDialog.cs b/neo-gui/UI/InvokeContractDialog.cs index 54fcfc9d..5341a655 100644 --- a/neo-gui/UI/InvokeContractDialog.cs +++ b/neo-gui/UI/InvokeContractDialog.cs @@ -145,7 +145,7 @@ private void button5_Click(object sender, EventArgs e) if (engine.Execute()) { tx.Gas = engine.GasConsumed - Fixed8.FromDecimal(10); - if (tx.Gas < Fixed8.Zero) tx.Gas = Fixed8.Zero; + if (tx.Gas < Fixed8.One) tx.Gas = Fixed8.One; tx.Gas = tx.Gas.Ceiling(); label7.Text = tx.Gas + " gas"; button3.Enabled = true; diff --git a/neo-gui/UI/MainForm.cs b/neo-gui/UI/MainForm.cs index 41fa08e5..0f3e6dd9 100644 --- a/neo-gui/UI/MainForm.cs +++ b/neo-gui/UI/MainForm.cs @@ -781,12 +781,19 @@ private void viewContractToolStripMenuItem_Click(object sender, EventArgs e) private void voteToolStripMenuItem_Click(object sender, EventArgs e) { + InvocationTransaction tx; Contract contract = (Contract)listView1.SelectedItems[0].Tag; using (VotingDialog dialog = new VotingDialog(contract.ScriptHash)) { if (dialog.ShowDialog() != DialogResult.OK) return; - Helper.SignAndShowInformation(dialog.GetTransaction()); + tx = dialog.GetTransaction(); } + using (InvokeContractDialog dialog = new InvokeContractDialog(tx)) + { + if (dialog.ShowDialog() != DialogResult.OK) return; + tx = dialog.GetTransaction(); + } + Helper.SignAndShowInformation(tx); } private void 复制到剪贴板CToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/neo-gui/UI/VotingDialog.cs b/neo-gui/UI/VotingDialog.cs index 7ced6d45..af89a7b5 100644 --- a/neo-gui/UI/VotingDialog.cs +++ b/neo-gui/UI/VotingDialog.cs @@ -21,11 +21,9 @@ public InvocationTransaction GetTransaction() sb.EmitPush(script_hash.ToArray()); sb.EmitSysCall("Neo.Blockchain.GetAccount"); sb.EmitSysCall("Neo.Account.SetVotes"); - return Program.CurrentWallet.MakeTransaction(new InvocationTransaction + return new InvocationTransaction { - Version = 1, Script = sb.ToArray(), - Gas = Fixed8.Zero, Attributes = new[] { new TransactionAttribute @@ -34,7 +32,7 @@ public InvocationTransaction GetTransaction() Data = script_hash.ToArray() } } - }, fee: Fixed8.One); + }; } }