From bc88cdc4ec0eb8867c84965cb1b23396390e4ccc Mon Sep 17 00:00:00 2001 From: webwarrior Date: Tue, 16 Jul 2024 10:11:07 +0200 Subject: [PATCH] scripts,Backend(Tests): default to native segwit Make native segwit default by always adding NATIVE_SEGWIT to defined constants in configure.fsx. To make tests work properly with native segwit, rename deprecated OriginAddress property to OriginMainAddress in test data. --- scripts/configure.fsx | 11 +++-------- .../data/signedAndFormattedBtcTransaction.json | 2 +- .../data/signedAndFormattedEtherTransaction.json | 2 +- .../data/signedAndFormattedSaiTransaction.json | 2 +- .../data/unsignedAndFormattedBtcTransaction.json | 2 +- .../data/unsignedAndFormattedEtherTransaction.json | 2 +- .../data/unsignedAndFormattedSaiTransaction.json | 2 +- src/GWallet.Backend/Transaction.fs | 6 ------ 8 files changed, 9 insertions(+), 20 deletions(-) diff --git a/scripts/configure.fsx b/scripts/configure.fsx index 8a9c78159..1de5d5ae4 100644 --- a/scripts/configure.fsx +++ b/scripts/configure.fsx @@ -217,14 +217,9 @@ let configFileToBeWritten = | None -> configFileStageTwo let finalConfigFile = - let nativeSegwitEnabled = - argsToThisFsxScript - |> List.contains "--native-segwit" - if nativeSegwitEnabled then - configFileStageThree - |> AddToDefinedConstants "NATIVE_SEGWIT" - else - configFileStageThree + // native segwit is enabled by default + configFileStageThree + |> AddToDefinedConstants "NATIVE_SEGWIT" finalConfigFile diff --git a/src/GWallet.Backend.Tests/data/signedAndFormattedBtcTransaction.json b/src/GWallet.Backend.Tests/data/signedAndFormattedBtcTransaction.json index 05ec34f6b..d88f96f62 100644 --- a/src/GWallet.Backend.Tests/data/signedAndFormattedBtcTransaction.json +++ b/src/GWallet.Backend.Tests/data/signedAndFormattedBtcTransaction.json @@ -4,7 +4,7 @@ "Value": { "TransactionInfo": { "Proposal": { - "OriginAddress": "16pKBjGGZkUXo1afyBNf5ttFvV9hauS1kR", + "OriginMainAddress": "16pKBjGGZkUXo1afyBNf5ttFvV9hauS1kR", "Amount": { "ValueToSend": 10.01, "BalanceAtTheMomentOfSending": 12.02, diff --git a/src/GWallet.Backend.Tests/data/signedAndFormattedEtherTransaction.json b/src/GWallet.Backend.Tests/data/signedAndFormattedEtherTransaction.json index 68b8e4e3c..e4db17589 100644 --- a/src/GWallet.Backend.Tests/data/signedAndFormattedEtherTransaction.json +++ b/src/GWallet.Backend.Tests/data/signedAndFormattedEtherTransaction.json @@ -4,7 +4,7 @@ "Value": { "TransactionInfo": { "Proposal": { - "OriginAddress": "0xf3j4m0rjx94sushh03j", + "OriginMainAddress": "0xf3j4m0rjx94sushh03j", "Amount": { "ValueToSend": 10.01, "BalanceAtTheMomentOfSending": 12.02, diff --git a/src/GWallet.Backend.Tests/data/signedAndFormattedSaiTransaction.json b/src/GWallet.Backend.Tests/data/signedAndFormattedSaiTransaction.json index 70e6e14c1..fa7595f48 100644 --- a/src/GWallet.Backend.Tests/data/signedAndFormattedSaiTransaction.json +++ b/src/GWallet.Backend.Tests/data/signedAndFormattedSaiTransaction.json @@ -4,7 +4,7 @@ "Value": { "TransactionInfo": { "Proposal": { - "OriginAddress": "0xba766d6d13E2Cc921Bf6e896319D32502af9e37E", + "OriginMainAddress": "0xba766d6d13E2Cc921Bf6e896319D32502af9e37E", "Amount": { "ValueToSend": 1.0, "BalanceAtTheMomentOfSending": 7.08, diff --git a/src/GWallet.Backend.Tests/data/unsignedAndFormattedBtcTransaction.json b/src/GWallet.Backend.Tests/data/unsignedAndFormattedBtcTransaction.json index 35781105e..8aaefb17f 100644 --- a/src/GWallet.Backend.Tests/data/unsignedAndFormattedBtcTransaction.json +++ b/src/GWallet.Backend.Tests/data/unsignedAndFormattedBtcTransaction.json @@ -3,7 +3,7 @@ "TypeName": "GWallet.Backend.UnsignedTransaction`1[GWallet.Backend.UtxoCoin.TransactionMetadata]", "Value": { "Proposal": { - "OriginAddress": "16pKBjGGZkUXo1afyBNf5ttFvV9hauS1kR", + "OriginMainAddress": "16pKBjGGZkUXo1afyBNf5ttFvV9hauS1kR", "Amount": { "ValueToSend": 10.01, "BalanceAtTheMomentOfSending": 12.02, diff --git a/src/GWallet.Backend.Tests/data/unsignedAndFormattedEtherTransaction.json b/src/GWallet.Backend.Tests/data/unsignedAndFormattedEtherTransaction.json index e7ac16878..1c572b0d6 100644 --- a/src/GWallet.Backend.Tests/data/unsignedAndFormattedEtherTransaction.json +++ b/src/GWallet.Backend.Tests/data/unsignedAndFormattedEtherTransaction.json @@ -3,7 +3,7 @@ "TypeName": "GWallet.Backend.UnsignedTransaction`1[GWallet.Backend.Ether.TransactionMetadata]", "Value": { "Proposal": { - "OriginAddress": "0xf3j4m0rjx94sushh03j", + "OriginMainAddress": "0xf3j4m0rjx94sushh03j", "Amount": { "ValueToSend": 10.01, "BalanceAtTheMomentOfSending": 12.02, diff --git a/src/GWallet.Backend.Tests/data/unsignedAndFormattedSaiTransaction.json b/src/GWallet.Backend.Tests/data/unsignedAndFormattedSaiTransaction.json index 3b3e067c2..4522bc557 100644 --- a/src/GWallet.Backend.Tests/data/unsignedAndFormattedSaiTransaction.json +++ b/src/GWallet.Backend.Tests/data/unsignedAndFormattedSaiTransaction.json @@ -3,7 +3,7 @@ "TypeName": "GWallet.Backend.UnsignedTransaction`1[GWallet.Backend.Ether.TransactionMetadata]", "Value": { "Proposal": { - "OriginAddress": "0xba766d6d13E2Cc921Bf6e896319D32502af9e37E", + "OriginMainAddress": "0xba766d6d13E2Cc921Bf6e896319D32502af9e37E", "Amount": { "ValueToSend": 1.0, "BalanceAtTheMomentOfSending": 7.08, diff --git a/src/GWallet.Backend/Transaction.fs b/src/GWallet.Backend/Transaction.fs index 17f17669b..b605e5884 100644 --- a/src/GWallet.Backend/Transaction.fs +++ b/src/GWallet.Backend/Transaction.fs @@ -10,9 +10,6 @@ type ITransactionDetails = type internal SignedTransactionDetails = { -#if !NATIVE_SEGWIT - [] -#endif OriginMainAddress: string Amount: decimal @@ -27,9 +24,6 @@ type internal SignedTransactionDetails = type UnsignedTransactionProposal = { -#if !NATIVE_SEGWIT - [] -#endif OriginMainAddress: string Amount: TransferAmount;