Skip to content

Commit

Permalink
Backend: rename .OriginAddress to .OriginMainAddress
Browse files Browse the repository at this point in the history
This way, if a non-segwit capable version of geewallet tries to
deserialize a transaction proposal, it will error out complaining
about version mismatch instead of crashing with a weird error.
  • Loading branch information
knocte committed Feb 12, 2024
1 parent b8c6bf4 commit a51dec9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/GWallet.Backend/Account.fs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ module Account =
else
transactionProposal.Amount.ValueToSend + fee.FeeValue
Caching.Instance.StoreOutgoingTransaction
transactionProposal.OriginAddress
transactionProposal.OriginMainAddress
transactionProposal.Amount.Currency
fee.Currency
txId
Expand Down Expand Up @@ -445,7 +445,7 @@ module Account =

let transactionProposal =
{
OriginAddress = baseAccount.PublicAddress
OriginMainAddress = baseAccount.PublicAddress
Amount = amount
DestinationAddress = destination
}
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Backend/Ether/EtherAccount.fs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ module internal Account =

let txDetails =
{
OriginAddress = signer.GetSenderAddress signedTransaction.RawTransaction
OriginMainAddress = signer.GetSenderAddress signedTransaction.RawTransaction
Amount = UnitConversion.Convert.FromWei (IntTypeDecoder().DecodeBigInteger tx.Value)
Currency = getTransactionCurrency tx
DestinationAddress = destAddress
Expand Down
10 changes: 5 additions & 5 deletions src/GWallet.Backend/Transaction.fs
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
namespace GWallet.Backend

type ITransactionDetails =
abstract member OriginAddress: string
abstract member OriginMainAddress: string
abstract member Amount: decimal
abstract member Currency: Currency
abstract member DestinationAddress: string

type internal SignedTransactionDetails =
{
OriginAddress: string
OriginMainAddress: string
Amount: decimal
Currency: Currency
DestinationAddress: string
}
interface ITransactionDetails with
member self.OriginAddress = self.OriginAddress
member self.OriginMainAddress = self.OriginMainAddress
member self.Amount = self.Amount
member self.Currency = self.Currency
member self.DestinationAddress = self.DestinationAddress

type UnsignedTransactionProposal =
{
OriginAddress: string;
OriginMainAddress: string
Amount: TransferAmount;
DestinationAddress: string;
}
interface ITransactionDetails with
member self.OriginAddress = self.OriginAddress
member self.OriginMainAddress = self.OriginMainAddress
member self.Amount = self.Amount.ValueToSend
member self.Currency = self.Amount.Currency
member self.DestinationAddress = self.DestinationAddress
Expand Down
2 changes: 1 addition & 1 deletion src/GWallet.Backend/UtxoCoin/UtxoCoinAccount.fs
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ module Account =
failwith "expected a single destination address"

{
OriginAddress = (account :> IAccount).PublicAddress
OriginMainAddress = (account :> IAccount).PublicAddress
DestinationAddress = destinationAddress.ToString()
Amount = value.ToDecimal MoneyUnit.BTC
Currency = currency
Expand Down

0 comments on commit a51dec9

Please sign in to comment.