From c0f8eb67a34c881e236d575e67a90d5e0c2fc783 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 21 Mar 2022 23:37:57 +1000 Subject: [PATCH] Update lightwalletd acceptance test for getblockchaininfo RPC (#3914) --- zebrad/tests/acceptance.rs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index d7937ac54b6..a8fb14e8394 100644 --- a/zebrad/tests/acceptance.rs +++ b/zebrad/tests/acceptance.rs @@ -1036,26 +1036,42 @@ fn lightwalletd_integration() -> Result<()> { // Check that `lightwalletd` is calling the expected Zebra RPCs // getblockchaininfo - let result = lightwalletd.expect_stdout_line_matches("Got sapling height"); + // + // TODO: update branchID when we're using cached state (#3511) + let result = lightwalletd.expect_stdout_line_matches( + "Got sapling height 419200 block height [0-9]+ chain main branchID 00000000", + ); let (_, zebrad) = zebrad.kill_on_error(result)?; let result = lightwalletd.expect_stdout_line_matches("Found 0 blocks in cache"); let (_, zebrad) = zebrad.kill_on_error(result)?; - // getblock with block 1 in Zebra's state + // getblock with the first Sapling block in Zebra's state // // zcash/lightwalletd calls getbestblockhash here, but // adityapk00/lightwalletd calls getblock // - // Until block 1 has been downloaded, lightwalletd will log Zebra's RPC error: + // The log also depends on what is in Zebra's state: + // + // # Empty Zebra State + // + // lightwalletd tries to download the Sapling activation block, but it's not in the state. + // + // Until the Sapling activation block has been downloaded, lightwalletd will log Zebra's RPC error: // "error requesting block: 0: Block not found" - // But we can't check for that, because Zebra might download genesis before lightwalletd asks. // We also get a similar log when lightwalletd reaches the end of Zebra's cache. // - // After the first getblock call, lightwalletd will log: + // # Cached Zebra State + // + // After the first successful getblock call, lightwalletd will log: // "Block hash changed, clearing mempool clients" // But we can't check for that, because it can come before or after the Ingestor log. - let result = lightwalletd.expect_stdout_line_matches("Ingestor adding block to cache"); + // + // TODO: expect Ingestor log when we're using cached state (#3511) + // "Ingestor adding block to cache" + let result = lightwalletd.expect_stdout_line_matches( + r#"error requesting block: 0: Block not found","height":419200"#, + ); let (_, zebrad) = zebrad.kill_on_error(result)?; // (next RPC)