mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-15 06:50:19 +00:00
scan for names owned by wallet
This commit is contained in:
@@ -15,6 +15,7 @@ module Simplex.Chat.Wallet
|
||||
deriveAccountKey,
|
||||
accountSecret,
|
||||
checkAccountIndex,
|
||||
scanGapLimit,
|
||||
)
|
||||
where
|
||||
|
||||
@@ -57,6 +58,11 @@ data WalletError
|
||||
| WEDerivation {derivationError :: String} -- BIP-32 or BIP-39 said no
|
||||
deriving (Eq, Show)
|
||||
|
||||
-- | BIP-44's gap limit: a scan of a recovered seed stops after this many
|
||||
-- accounts in a row that nothing on chain has used.
|
||||
scanGapLimit :: Int
|
||||
scanGapLimit = 20
|
||||
|
||||
-- | Refuse an index at or above 2^31: BIP-32 would harden it onto another index's key.
|
||||
checkAccountIndex :: AccountIndex -> Either WalletError ()
|
||||
checkAccountIndex n = if n >= B32.hardenedOffset then Left WEIndexTooLarge else Right ()
|
||||
|
||||
Reference in New Issue
Block a user