RPC Server #103

Merged
pitmutt merged 129 commits from rav001 into milestone3 2024-11-21 15:30:22 +00:00
3 changed files with 30 additions and 16 deletions
Showing only changes of commit 6a4bbb587c - Show all commits

View file

@ -1611,10 +1611,24 @@ getOrchardCmxs pool zt = do
getMaxOrchardNote :: Pool SqlBackend -> IO OrchActionId getMaxOrchardNote :: Pool SqlBackend -> IO OrchActionId
getMaxOrchardNote pool = do getMaxOrchardNote pool = do
flip PS.runSqlPool pool $ do flip PS.runSqlPool pool $ do
maxBlock <-
selectOne $ do
blks <- from $ table @ZcashBlock
where_ $ blks ^. ZcashBlockHeight >. val 0
pure $ blks ^. ZcashBlockHeight
case maxBlock of
Nothing -> return $ toSqlKey 0
Just (Value mb) -> do
x <- x <-
selectOne $ do selectOne $ do
n <- from $ table @OrchAction (blks :& txs :& n) <-
where_ (n ^. OrchActionId >. val (toSqlKey 0)) from $ table @ZcashBlock `innerJoin` table @ZcashTransaction `on`
(\(blks :& txs) ->
blks ^. ZcashBlockId ==. txs ^. ZcashTransactionBlockId) `innerJoin`
table @OrchAction `on`
(\(_ :& txs :& n) ->
txs ^. ZcashTransactionId ==. n ^. OrchActionTx)
where_ (blks ^. ZcashBlockHeight <=. val (mb - 5))
orderBy [desc $ n ^. OrchActionId] orderBy [desc $ n ^. OrchActionId]
pure (n ^. OrchActionId) pure (n ^. OrchActionId)
case x of case x of

View file

@ -265,7 +265,7 @@ main = do
18232 18232
TestNet TestNet
(toSqlKey 1) (toSqlKey 1)
3000789 3000785
0.005 0.005
(fromJust uaRead) (fromJust uaRead)
"Sending memo to orchard" "Sending memo to orchard"
@ -286,15 +286,15 @@ main = do
"localhost" "localhost"
18232 18232
TestNet TestNet
(toSqlKey 1) (toSqlKey 4)
2999396 3000789
0.005 0.005
(fromJust uaRead) (fromJust uaRead)
"Sending memo to orchard" "Sending memo to sapling"
Full Full
tx `shouldBe` Right (hexString "deadbeef") tx `shouldBe` Right (hexString "deadbeef")
describe "Medium" $ do describe "Medium" $ do
it "To Orchard" $ do xit "To Orchard" $ do
let uaRead = let uaRead =
parseAddress parseAddress
"utest1dl54utt6prjj5e0dnlknwumnxq9hycdjpkfr0sy6e6h522remqee8axe9zax0wsjrwpj76v555pdhvj9rnargpfyycs0vpkapq98xcdhem99gc4wchzn0ggepq3y6nz3a9sscwgqxgsh9vzhcad402y3x9szfregck5gslkya3c79d86xx0l33tpk8gnn7ew9vw37w43zh22u8dgdax" "utest1dl54utt6prjj5e0dnlknwumnxq9hycdjpkfr0sy6e6h522remqee8axe9zax0wsjrwpj76v555pdhvj9rnargpfyycs0vpkapq98xcdhem99gc4wchzn0ggepq3y6nz3a9sscwgqxgsh9vzhcad402y3x9szfregck5gslkya3c79d86xx0l33tpk8gnn7ew9vw37w43zh22u8dgdax"
@ -316,7 +316,7 @@ main = do
"Sending memo to orchard" "Sending memo to orchard"
Medium Medium
tx `shouldBe` Right (hexString "deadbeef") tx `shouldBe` Right (hexString "deadbeef")
it "To Sapling" $ do xit "To Sapling" $ do
let uaRead = let uaRead =
parseAddress parseAddress
"ztestsapling136jp8z89v2jh6kqd5rs4dtvlxym90m43svzdwzxaplyvc5ttzppytpvx80ncllcsqzpmukxjl3y" "ztestsapling136jp8z89v2jh6kqd5rs4dtvlxym90m43svzdwzxaplyvc5ttzppytpvx80ncllcsqzpmukxjl3y"
@ -332,9 +332,9 @@ main = do
18232 18232
TestNet TestNet
(toSqlKey 1) (toSqlKey 1)
2999396 3000789
0.005 0.005
(fromJust uaRead) (fromJust uaRead)
"Sending memo to orchard" "Sending memo to orchard"
Full Medium
tx `shouldBe` Right (hexString "deadbeef") tx `shouldBe` Right (hexString "deadbeef")

@ -1 +1 @@
Subproject commit 63a97b880cb32d8e008650f0efef2fdadc7d3d4a Subproject commit 12296026a0ebb9a5afe0904b251c5d31080eab18