From 89dc75cd900c89d3c1d4050418a2866ec056670c Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 13 Jul 2022 19:34:48 -0700 Subject: [PATCH] lntest/itest: add test case for conf ntfn w/ block In this commit, we add a test case to exercise the fact that if we request a confirmation notification with the raw block, then it includes one. We add this to the existing test that uses the conf ntfn rpc call for simplicity. --- lntest/itest/lnd_taproot_test.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lntest/itest/lnd_taproot_test.go b/lntest/itest/lnd_taproot_test.go index 1b9e6b6a9..20f080404 100644 --- a/lntest/itest/lnd_taproot_test.go +++ b/lntest/itest/lnd_taproot_test.go @@ -1297,12 +1297,16 @@ func confirmAddress(ctx context.Context, t *harnessTest, _, currentHeight, err := net.Miner.Client.GetBestBlock() require.NoError(t.t, err) + + // We'll register for a conf notification, and also request the block + // that included it as well. confClient, err := node.ChainClient.RegisterConfirmationsNtfn( ctx, &chainrpc.ConfRequest{ - Script: addrPkScript, - Txid: txid[:], - HeightHint: uint32(currentHeight), - NumConfs: 1, + Script: addrPkScript, + Txid: txid[:], + HeightHint: uint32(currentHeight), + NumConfs: 1, + IncludeBlock: true, }, ) require.NoError(t.t, err) @@ -1310,12 +1314,18 @@ func confirmAddress(ctx context.Context, t *harnessTest, // Mine another block to clean up the mempool. mineBlocks(t, net, 1, 1) - // We now expect our confirmation to go through. + // We now expect our confirmation to go through, and also that the + // block was specified. confMsg, err := confClient.Recv() require.NoError(t.t, err) conf := confMsg.GetConf() require.NotNil(t.t, conf) require.Equal(t.t, conf.BlockHeight, uint32(currentHeight+1)) + require.NotNil(t.t, conf.RawBlock) + + // We should also be able to decode the raw block. + var blk wire.MsgBlock + require.NoError(t.t, blk.Deserialize(bytes.NewReader(conf.RawBlock))) } // deriveSigningKeys derives three signing keys and returns their descriptors,