Skip to content

Commit

Permalink
Backend(UtxoCoin): fix deserialization error
Browse files Browse the repository at this point in the history
This commit fixes the deserialization error happening
when returned error is a simple string instead of an object
containing errorCode and errorMsg.

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

Co-authored-by: Mersho <[email protected]>
  • Loading branch information
aarani and Mersho committed Oct 12, 2023
1 parent 97a1ed4 commit 2bdfd9c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/GWallet.Backend/UtxoCoin/StratumClient.fs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,22 @@ type BlockchainTransactionBroadcastResult =
Result: string;
}

[<System.ComponentModel.TypeConverter(typeof<StringToErrorInnerResultConverter>)>]
type ErrorInnerResult =
{
Message: string;
Code: int;
}
and StringToErrorInnerResultConverter() =
inherit System.ComponentModel.TypeConverter()
override __.CanConvertFrom (_, sourceType) = (sourceType = typeof<string>)
override __.ConvertFrom(_, _, value) =
{
Message = value :?> string
Code = 0
}
|> box
override __.CanConvertTo (_, _) = false

type ErrorResult =
{
Expand Down

0 comments on commit 2bdfd9c

Please sign in to comment.