rvv041 #82
3 changed files with 19 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
|||
.stack-work/
|
||||
*~
|
||||
dist-newstyle/
|
||||
zenith.db
|
||||
zenith.log
|
|
@ -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
|
||||
|
|
BIN
zenith.db
BIN
zenith.db
Binary file not shown.
Loading…
Reference in a new issue