Skip to content

Commit

Permalink
scripts,Backend(Tests): default to native segwit
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
webwarrior-ws committed Jul 24, 2024
1 parent 9feb545 commit bc88cdc
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 20 deletions.
11 changes: 3 additions & 8 deletions scripts/configure.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Value": {
"TransactionInfo": {
"Proposal": {
"OriginAddress": "16pKBjGGZkUXo1afyBNf5ttFvV9hauS1kR",
"OriginMainAddress": "16pKBjGGZkUXo1afyBNf5ttFvV9hauS1kR",
"Amount": {
"ValueToSend": 10.01,
"BalanceAtTheMomentOfSending": 12.02,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Value": {
"TransactionInfo": {
"Proposal": {
"OriginAddress": "0xf3j4m0rjx94sushh03j",
"OriginMainAddress": "0xf3j4m0rjx94sushh03j",
"Amount": {
"ValueToSend": 10.01,
"BalanceAtTheMomentOfSending": 12.02,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Value": {
"TransactionInfo": {
"Proposal": {
"OriginAddress": "0xba766d6d13E2Cc921Bf6e896319D32502af9e37E",
"OriginMainAddress": "0xba766d6d13E2Cc921Bf6e896319D32502af9e37E",
"Amount": {
"ValueToSend": 1.0,
"BalanceAtTheMomentOfSending": 7.08,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions src/GWallet.Backend/Transaction.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ type ITransactionDetails =

type internal SignedTransactionDetails =
{
#if !NATIVE_SEGWIT
[<JsonProperty(PropertyName = "OriginAddress")>]
#endif
OriginMainAddress: string

Amount: decimal
Expand All @@ -27,9 +24,6 @@ type internal SignedTransactionDetails =

type UnsignedTransactionProposal =
{
#if !NATIVE_SEGWIT
[<JsonProperty(PropertyName = "OriginAddress")>]
#endif
OriginMainAddress: string

Amount: TransferAmount;
Expand Down

0 comments on commit bc88cdc

Please sign in to comment.