Skip to content

Commit

Permalink
Backend: remove readonly accs migration
Browse files Browse the repository at this point in the history
Remove readonly accounts migration to native segwit.
  • Loading branch information
webwarrior-ws committed Jul 23, 2024
1 parent 57baa4f commit f3d4f39
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 36 deletions.
7 changes: 1 addition & 6 deletions src/GWallet.Backend/Account.fs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@ type UnhandledCurrencyServerException(currency: Currency,

module Account =

let private isInitialized (accounts: seq<IAccount>) = lazy(
let private isInitialized (_accounts: seq<IAccount>) = lazy(
Config.Init()

let readonlyUtxoAccounts =
accounts.Where(fun acc -> acc.Currency.IsUtxo()).OfType<ReadOnlyAccount>()

UtxoCoin.Account.MigrateReadOnlyAccountsToNativeSegWit readonlyUtxoAccounts
)

let private GetShowableBalanceAndImminentPaymentInternal (account: IAccount)
Expand Down
30 changes: 0 additions & 30 deletions src/GWallet.Backend/UtxoCoin/UtxoCoinAccount.fs
Original file line number Diff line number Diff line change
Expand Up @@ -700,36 +700,6 @@ module Account =
Config.AddAccount conceptAccountForReadOnlyAccount AccountKind.ReadOnly
|> ignore<FileRepresentation>

let internal MigrateReadOnlyAccountsToNativeSegWit (readOnlyUtxoAccounts: seq<ReadOnlyAccount>): unit =
let utxoAccountsToMigrate =
seq {
for utxoAccount in readOnlyUtxoAccounts do
let accountFile = utxoAccount.AccountFile
let prefix =
match (utxoAccount :> IAccount).Currency with
| Currency.BTC ->
BITCOIN_ADDRESS_BECH32_PREFIX
| Currency.LTC ->
LITECOIN_ADDRESS_BECH32_PREFIX
| otherCurrency -> failwith <| SPrintF1 "Missed UTXO currency %A when implementing NativeSegwit migration?" otherCurrency
if not (accountFile.Name.StartsWith prefix) then
yield utxoAccount
}

let utxoPublicKeys =
seq {
for utxoReadOnlyAccount in utxoAccountsToMigrate do
let accountFile = utxoReadOnlyAccount.AccountFile
let utxoPublicKey = accountFile.Content()
yield utxoPublicKey
} |> Set.ofSeq

for utxoPublicKey in utxoPublicKeys do
CreateReadOnlyAccounts utxoPublicKey

for utxoReadOnlyAccount in utxoAccountsToMigrate do
Config.RemoveReadOnlyAccount utxoReadOnlyAccount

let GetSignedTransactionDetails<'T when 'T :> IBlockchainFeeInfo>(rawTransaction: string)
(currency: Currency)
(readonlyUtxoAccounts: seq<ReadOnlyUtxoAccount>)
Expand Down

0 comments on commit f3d4f39

Please sign in to comment.