Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix output json for multisigaddress transaction #86

Merged
merged 4 commits into from
Apr 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions RpcWallet/RpcWallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ private JObject SendFrom(UIntBase assetId, UInt160 from, UInt160 to, string valu

ContractParametersContext transContext = new ContractParametersContext(tx);
Wallet.Sign(transContext);
if (!transContext.Completed)
return transContext.ToJson();
tx.Witnesses = transContext.GetWitnesses();
if (tx.Size > 1024)
{
Expand All @@ -323,11 +325,11 @@ private JObject SendFrom(UIntBase assetId, UInt160 from, UInt160 to, string valu
tx = Wallet.MakeTransaction(null, new[]
{
new TransferOutput
{
AssetId = assetId,
Value = amount,
ScriptHash = to
}
{
AssetId = assetId,
Value = amount,
ScriptHash = to
}
}, from: from, change_address: change_address, fee: fee);
if (tx == null)
throw new RpcException(-300, "Insufficient funds");
Expand Down Expand Up @@ -365,6 +367,8 @@ private JObject SendMany(UInt160 from, JArray to, Fixed8 fee, UInt160 change_add

ContractParametersContext transContext = new ContractParametersContext(tx);
Wallet.Sign(transContext);
if (!transContext.Completed)
return transContext.ToJson();
tx.Witnesses = transContext.GetWitnesses();
if (tx.Size > 1024)
{
Expand All @@ -375,7 +379,7 @@ private JObject SendMany(UInt160 from, JArray to, Fixed8 fee, UInt160 change_add
tx = Wallet.MakeTransaction(null, outputs, from: from, change_address: change_address, fee: fee);
if (tx == null)
throw new RpcException(-300, "Insufficient funds");
}
}
}
if (fee > Settings.Default.MaxFee)
throw new RpcException(-301, "The necessary fee is more than the Max_fee, this transaction is failed. Please increase your Max_fee value.");
Expand Down Expand Up @@ -405,6 +409,8 @@ private JObject SendToAddress(UIntBase assetId, UInt160 scriptHash, string value

ContractParametersContext transContext = new ContractParametersContext(tx);
Wallet.Sign(transContext);
if (!transContext.Completed)
return transContext.ToJson();
tx.Witnesses = transContext.GetWitnesses();
if (tx.Size > 1024)
{
Expand All @@ -423,8 +429,8 @@ private JObject SendToAddress(UIntBase assetId, UInt160 scriptHash, string value
}, change_address: change_address, fee: fee);
if (tx == null)
throw new RpcException(-300, "Insufficient funds");
}
}
}
}
if (fee > Settings.Default.MaxFee)
throw new RpcException(-301, "The necessary fee is more than the Max_fee, this transaction is failed. Please increase your Max_fee value.");
return SignAndRelay(tx);
Expand Down