RPC Server #103
3 changed files with 30 additions and 16 deletions
|
@ -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
|
||||||
|
|
16
test/Spec.hs
16
test/Spec.hs
|
@ -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
|
Loading…
Reference in a new issue