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

Backend: make sure fee is less than out #221

Merged
merged 3 commits into from
Oct 5, 2023

Conversation

aarani
Copy link
Contributor

@aarani aarani commented Sep 12, 2023

This prevents any future bug to cause unreasonable fees.

@aarani aarani force-pushed the minerFeeAssert branch 5 times, most recently from 6d9a77b to fad07ba Compare September 13, 2023 12:26
@knocte
Copy link
Member

knocte commented Sep 17, 2023

I tested this today with BTC and I got this crash:

System.Exception: Some problem when connecting to electrum.blockstream.info ---> System.Exception: Failed deserializing JSON response (to check for error) '{"error":"bad tx_hash","id":0,"jsonrpc":"2.0"}' to type 'GWallet.Backend.UtxoCoin.BlockchainTransactionGetResult' ---> Newtonsoft.Json.JsonSerializationException: Error converting value "bad tx_hash" to type 'GWallet.Backend.UtxoCoin.ErrorInnerResult'. Path 'error', line 1, position 22. ---> System.ArgumentException: Could not cast or convert from System.String to GWallet.Backend.UtxoCoin.ErrorInnerResult.
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   --- End of inner exception stack trace ---
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   at GWallet.Backend.UtxoCoin.StratumClient.Deserialize[T](String result)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@130-18.Invoke(Unit unitVar)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-39.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.AsyncPrimitives.unitAsync@589.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@125-42.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$JsonRpcTcpClient.Request@90-3.Invoke(AsyncActivation`1 ctxt)
   at GWallet.Backend.FSharpUtil.WithTimeout@187-2.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-20.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-38.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-40.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
   --- End of inner exception stack trace ---
   at GWallet.Backend.UtxoCoin.Server.ElectrumServerToRetrievalFunc@70-3.Invoke(Exception _arg1)
   at GWallet.Backend.UtxoCoin.Server.ElectrumServerToRetrievalFunc@70-6.Invoke(Exception exn)
   at GWallet.Backend.UtxoCoin.Server.ElectrumServerToRetrievalFunc@70-8.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
System.AggregateException: One or more errors occurred. ---> System.Exception: Some problem when connecting to electrum.blockstream.info ---> System.Exception: Failed deserializing JSON response (to check for error) '{"error":"bad tx_hash","id":0,"jsonrpc":"2.0"}' to type 'GWallet.Backend.UtxoCoin.BlockchainTransactionGetResult' ---> Newtonsoft.Json.JsonSerializationException: Error converting value "bad tx_hash" to type 'GWallet.Backend.UtxoCoin.ErrorInnerResult'. Path 'error', line 1, position 22. ---> System.ArgumentException: Could not cast or convert from System.String to GWallet.Backend.UtxoCoin.ErrorInnerResult.
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   --- End of inner exception stack trace ---
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   at GWallet.Backend.UtxoCoin.StratumClient.Deserialize[T](String result)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@130-18.Invoke(Unit unitVar)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-39.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.AsyncPrimitives.unitAsync@589.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@125-42.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$JsonRpcTcpClient.Request@90-3.Invoke(AsyncActivation`1 ctxt)
   at GWallet.Backend.FSharpUtil.WithTimeout@187-2.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-20.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-38.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-40.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
   --- End of inner exception stack trace ---
   at GWallet.Backend.Infrastructure.Report(Exception ex, ErrorLevel _arg1)
   at GWallet.Backend.Infrastructure.ReportWarning(Exception ex)
   at GWallet.Backend.UtxoCoin.Server.FaultTolerantParallelClientDefaultSettings@35.Invoke(Exception ex)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-8.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-15.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-17.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.clo@312-26.Invoke(ServerTask`2 _arg1)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.WhenAny@118-7.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.FSharp.Control.AsyncResult`1.Commit()
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation)
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout)
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken)
   at Program.sendPayment@13.Invoke(Boolean ignoreHigherMinerFeeThanAmount)
   at Program.TrySendAmount(NormalAccount account, IBlockchainFeeInfo transactionMetadata, String destination, TransferAmount amount)
   at Program.TrySendAmount(NormalAccount account, IBlockchainFeeInfo transactionMetadata, String destination, TransferAmount amount)
   at Program.TrySendAmount(NormalAccount account, IBlockchainFeeInfo transactionMetadata, String destination, TransferAmount amount)
   at Program.SendPaymentOfSpecificAmount(IAccount account, TransferAmount amount, IBlockchainFeeInfo transactionMetadata, String destination)
   at Program.SendPayment()
   at Program.PerformOperation(UInt32 numActiveAccounts, UInt32 numHotAccounts)
   at Program.ProgramMainLoop[a]()
   at Program.NormalStartWithNoParameters()
---> (Inner Exception #0) System.Exception: Some problem when connecting to electrum.blockstream.info ---> System.Exception: Failed deserializing JSON response (to check for error) '{"error":"bad tx_hash","id":0,"jsonrpc":"2.0"}' to type 'GWallet.Backend.UtxoCoin.BlockchainTransactionGetResult' ---> Newtonsoft.Json.JsonSerializationException: Error converting value "bad tx_hash" to type 'GWallet.Backend.UtxoCoin.ErrorInnerResult'. Path 'error', line 1, position 22. ---> System.ArgumentException: Could not cast or convert from System.String to GWallet.Backend.UtxoCoin.ErrorInnerResult.
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   --- End of inner exception stack trace ---
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   at GWallet.Backend.UtxoCoin.StratumClient.Deserialize[T](String result)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@130-18.Invoke(Unit unitVar)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-39.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.AsyncPrimitives.unitAsync@589.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@125-42.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$JsonRpcTcpClient.Request@90-3.Invoke(AsyncActivation`1 ctxt)
   at GWallet.Backend.FSharpUtil.WithTimeout@187-2.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-20.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-38.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-40.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
   --- End of inner exception stack trace ---
   at GWallet.Backend.Infrastructure.Report(Exception ex, ErrorLevel _arg1)
   at GWallet.Backend.Infrastructure.ReportWarning(Exception ex)
   at GWallet.Backend.UtxoCoin.Server.FaultTolerantParallelClientDefaultSettings@35.Invoke(Exception ex)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-8.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-15.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-17.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)<---

System.AggregateException: One or more errors occurred. ---> System.Exception: Some problem when connecting to electrum.blockstream.info ---> System.Exception: Failed deserializing JSON response (to check for error) '{"error":"bad tx_hash","id":0,"jsonrpc":"2.0"}' to type 'GWallet.Backend.UtxoCoin.BlockchainTransactionGetResult' ---> Newtonsoft.Json.JsonSerializationException: Error converting value "bad tx_hash" to type 'GWallet.Backend.UtxoCoin.ErrorInnerResult'. Path 'error', line 1, position 22. ---> System.ArgumentException: Could not cast or convert from System.String to GWallet.Backend.UtxoCoin.ErrorInnerResult.
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   --- End of inner exception stack trace ---
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   at GWallet.Backend.UtxoCoin.StratumClient.Deserialize[T](String result)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@130-18.Invoke(Unit unitVar)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-39.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.AsyncPrimitives.unitAsync@589.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@125-42.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$JsonRpcTcpClient.Request@90-3.Invoke(AsyncActivation`1 ctxt)
   at GWallet.Backend.FSharpUtil.WithTimeout@187-2.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-20.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-38.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-40.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
   --- End of inner exception stack trace ---
   at GWallet.Backend.Infrastructure.Report(Exception ex, ErrorLevel _arg1)
   at GWallet.Backend.Infrastructure.ReportWarning(Exception ex)
   at GWallet.Backend.UtxoCoin.Server.FaultTolerantParallelClientDefaultSettings@35.Invoke(Exception ex)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-8.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-15.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-17.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
   --- End of inner exception stack trace ---
   at GWallet.Backend.Infrastructure.Report(Exception ex, ErrorLevel _arg1)
   at GWallet.Backend.Infrastructure.LogOrReportCrash(Exception ex)
   at Program.NormalStartWithNoParameters()
   at Program.main(String[] argv)
---> (Inner Exception #0) System.Exception: Some problem when connecting to electrum.blockstream.info ---> System.Exception: Failed deserializing JSON response (to check for error) '{"error":"bad tx_hash","id":0,"jsonrpc":"2.0"}' to type 'GWallet.Backend.UtxoCoin.BlockchainTransactionGetResult' ---> Newtonsoft.Json.JsonSerializationException: Error converting value "bad tx_hash" to type 'GWallet.Backend.UtxoCoin.ErrorInnerResult'. Path 'error', line 1, position 22. ---> System.ArgumentException: Could not cast or convert from System.String to GWallet.Backend.UtxoCoin.ErrorInnerResult.
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   --- End of inner exception stack trace ---
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   at GWallet.Backend.UtxoCoin.StratumClient.Deserialize[T](String result)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@130-18.Invoke(Unit unitVar)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-39.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.AsyncPrimitives.unitAsync@589.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@125-42.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$JsonRpcTcpClient.Request@90-3.Invoke(AsyncActivation`1 ctxt)
   at GWallet.Backend.FSharpUtil.WithTimeout@187-2.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-20.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-38.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-40.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
   --- End of inner exception stack trace ---
   at GWallet.Backend.Infrastructure.Report(Exception ex, ErrorLevel _arg1)
   at GWallet.Backend.Infrastructure.ReportWarning(Exception ex)
   at GWallet.Backend.UtxoCoin.Server.FaultTolerantParallelClientDefaultSettings@35.Invoke(Exception ex)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-8.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-15.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-17.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)<---


Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.Exception: Some problem when connecting to electrum.blockstream.info ---> System.Exception: Failed deserializing JSON response (to check for error) '{"error":"bad tx_hash","id":0,"jsonrpc":"2.0"}' to type 'GWallet.Backend.UtxoCoin.BlockchainTransactionGetResult' ---> Newtonsoft.Json.JsonSerializationException: Error converting value "bad tx_hash" to type 'GWallet.Backend.UtxoCoin.ErrorInnerResult'. Path 'error', line 1, position 22. ---> System.ArgumentException: Could not cast or convert from System.String to GWallet.Backend.UtxoCoin.ErrorInnerResult.
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   --- End of inner exception stack trace ---
   at GWallet.Backend.UtxoCoin.StratumClient.DeserializeInternal[T](String result)
   at GWallet.Backend.UtxoCoin.StratumClient.Deserialize[T](String result)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@130-18.Invoke(Unit unitVar)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-39.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.AsyncPrimitives.unitAsync@589.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@125-42.Invoke(AsyncActivation`1 ctxt)
   at <StartupCode$GWallet-Backend>.$JsonRpcTcpClient.Request@90-3.Invoke(AsyncActivation`1 ctxt)
   at GWallet.Backend.FSharpUtil.WithTimeout@187-2.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-20.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-38.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$StratumClient.Request@129-40.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
   --- End of inner exception stack trace ---
   at GWallet.Backend.Infrastructure.Report(Exception ex, ErrorLevel _arg1)
   at GWallet.Backend.Infrastructure.ReportWarning(Exception ex)
   at GWallet.Backend.UtxoCoin.Server.FaultTolerantParallelClientDefaultSettings@35.Invoke(Exception ex)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-8.Invoke(Exception _arg2)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-15.Invoke(Exception exn)
   at <StartupCode$GWallet-Backend>.$FaultTolerantParallelClient.Run@136-17.Invoke(Exception edi)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation`1 ctxt, FSharpFunc`2 catchFilter, ExceptionDispatchInfo edi)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
   --- End of inner exception stack trace ---
   at GWallet.Backend.Infrastructure.Report(Exception ex, ErrorLevel _arg1)
   at GWallet.Backend.Infrastructure.LogOrReportCrash(Exception ex)
   at GWallet.Backend.Infrastructure.OnUnhandledException(Object _arg1, UnhandledExceptionEventArgs args)
   at GWallet.Backend.Infrastructure.SetupExceptionHook@179-4.Invoke(Object delegateArg0, UnhandledExceptionEventArgs delegateArg1)

@knocte knocte mentioned this pull request Sep 17, 2023
@aarani aarani force-pushed the minerFeeAssert branch 3 times, most recently from be97ade to 746a662 Compare October 2, 2023 13:18
@knocte
Copy link
Member

knocte commented Oct 3, 2023

@aarani what is that last 'fiup' commit? it doesn't make much sense from my point of view, I guess I'm missing something

@knocte
Copy link
Member

knocte commented Oct 3, 2023

@aarani what is that last 'fiup' commit? it doesn't make much sense from my point of view, I guess I'm missing something

PS: please don't push anything to this PR until you have answered the above and I have replied/acked.

@aarani
Copy link
Contributor Author

aarani commented Oct 3, 2023

@aarani what is that last 'fiup' commit? it doesn't make much sense from my point of view, I guess I'm missing something

The commit's purpose is to fix sanity check step. The Backend.Tests was referencing an old version of Logging package.

@aarani aarani force-pushed the minerFeeAssert branch 2 times, most recently from aaa8c2e to 86e96e5 Compare October 3, 2023 10:01
@knocte
Copy link
Member

knocte commented Oct 5, 2023

Question: does the prompt "are you absolutely sure..." happen before or after asking the user for the password to unlock the account?

@aarani
Copy link
Contributor Author

aarani commented Oct 5, 2023

Question: does the prompt "are you absolutely sure..." happen before or after asking the user for the password to unlock the account?

After.

@knocte
Copy link
Member

knocte commented Oct 5, 2023

After

Ok, let's change it to before, please. Otherwise I cannot test properly without losing a bunch of time and fees (and anyway , doing it before is better UX).

@knocte knocte merged commit e08ecb3 into nblockchain:stable Oct 5, 2023
26 of 36 checks passed
aarani added a commit to aarani/geewallet that referenced this pull request Oct 10, 2023
We noticed in [1] that some servers return error response
that has only a string error instead of an error object,
so we're adding a test to prove the issue.

[1] nblockchain#221
aarani added a commit to aarani/geewallet that referenced this pull request Oct 10, 2023
We noticed in [1] that some servers return error response
that has only a string error instead of an error object,
so we're adding a test to prove the issue.

[1] nblockchain#221
aarani added a commit to aarani/geewallet that referenced this pull request Oct 10, 2023
We noticed in [1] that some servers return error response
that has only a string error instead of an error object,
so we're adding a test to prove the issue.

[1] nblockchain#221
aarani added a commit to aarani/geewallet that referenced this pull request Oct 11, 2023
We noticed in [1] that some servers return error response
that has only a string error instead of an error object,
so we're adding a test to prove the issue.

The error originally happened when I passed uint256
as txId to GetBlockchainTransaction electrum request
when it should've been a string.

[1] nblockchain#221
aarani added a commit to aarani/geewallet that referenced this pull request Oct 16, 2023
We noticed in [1] that some servers return error response
that has only a string error instead of an error object,
so we're adding a test to prove the issue.

The error originally happened when I passed uint256
as txId to GetBlockchainTransaction electrum request
when it should've been a string.

[1] nblockchain#221
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants