RPC Server #103
1 changed files with 16 additions and 1 deletions
|
@ -2030,6 +2030,21 @@ getUnconfPoolBalance pool za = do
|
||||||
let oBal = sum oAmts
|
let oBal = sum oAmts
|
||||||
return $ AccountBalance tBal sBal oBal
|
return $ AccountBalance tBal sBal oBal
|
||||||
|
|
||||||
|
rewindWalletTransactions :: ConnectionPool -> Int -> IO ()
|
||||||
|
rewindWalletTransactions pool b = do
|
||||||
|
runNoLoggingT $
|
||||||
|
PS.retryOnBusy $
|
||||||
|
flip PS.runSqlPool pool $ do
|
||||||
|
delete $ do
|
||||||
|
_ <- from $ table @UserTx
|
||||||
|
return ()
|
||||||
|
delete $ do
|
||||||
|
txs <- from $ table @WalletTransaction
|
||||||
|
where_ $ txs ^. WalletTransactionBlock >. val b
|
||||||
|
return ()
|
||||||
|
update $ \w -> do
|
||||||
|
set w [ZcashWalletLastSync =. val b]
|
||||||
|
|
||||||
clearWalletTransactions :: ConnectionPool -> IO ()
|
clearWalletTransactions :: ConnectionPool -> IO ()
|
||||||
clearWalletTransactions pool = do
|
clearWalletTransactions pool = do
|
||||||
runNoLoggingT $
|
runNoLoggingT $
|
||||||
|
@ -2578,10 +2593,10 @@ completeSync pool st = do
|
||||||
-- | Rewind the data store to a given block height
|
-- | Rewind the data store to a given block height
|
||||||
rewindWalletData :: ConnectionPool -> Int -> IO ()
|
rewindWalletData :: ConnectionPool -> Int -> IO ()
|
||||||
rewindWalletData pool b = do
|
rewindWalletData pool b = do
|
||||||
|
rewindWalletTransactions pool b
|
||||||
runNoLoggingT $
|
runNoLoggingT $
|
||||||
PS.retryOnBusy $
|
PS.retryOnBusy $
|
||||||
flip PS.runSqlPool pool $
|
flip PS.runSqlPool pool $
|
||||||
delete $ do
|
delete $ do
|
||||||
blk <- from $ table @ZcashBlock
|
blk <- from $ table @ZcashBlock
|
||||||
where_ $ blk ^. ZcashBlockHeight >=. val b
|
where_ $ blk ^. ZcashBlockHeight >=. val b
|
||||||
clearWalletTransactions pool
|
|
||||||
|
|
Loading…
Reference in a new issue