diff --git a/.gitignore b/.gitignore index 1c231fa..32d1170 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .stack-work/ *~ dist-newstyle/ +zenith.db +zenith.log \ No newline at end of file diff --git a/src/Zenith/DB.hs b/src/Zenith/DB.hs index a48151d..26cf8d5 100644 --- a/src/Zenith/DB.hs +++ b/src/Zenith/DB.hs @@ -246,6 +246,12 @@ share position Int UniqueSSPos tx position deriving Show Eq + AddressBook + network ZcashNetDB + descrip T.Text + address HexStringDB + UniqueABA address + deriving Show Eq |] -- * Database functions @@ -1467,5 +1473,16 @@ readUnifiedAddressDB :: WalletAddress -> Maybe UnifiedAddress readUnifiedAddressDB = isValidUnifiedAddress . TE.encodeUtf8 . getUA . walletAddressUAddress +-- | Get list of external zcash addresses from database +getAdrBook :: ConnectionPool -> ZcashNet -> IO [Entity AddressBook] +getAdrBook pool n = + runNoLoggingT $ + PS.retryOnBusy $ + flip PS.runSqlPool pool $ do + select $ do + adrbook <- from $ table @AddressBook + where_ (adrbook ^. AddressBookNetwork ==. val (ZcashNetDB n)) + pure adrbook + rmdups :: Ord a => [a] -> [a] rmdups = map head . group . sort diff --git a/zenith.db b/zenith.db deleted file mode 100644 index 5629514..0000000 Binary files a/zenith.db and /dev/null differ