@@ -2698,6 +2698,59 @@ describe('tx tests', () => {
2698
2698
. build ( ) ;
2699
2699
await db . update ( block3 ) ;
2700
2700
2701
+ const block4 = new TestBlockBuilder ( {
2702
+ block_height : 4 ,
2703
+ index_block_hash : '0x04' ,
2704
+ parent_block_hash : block3 . block . block_hash ,
2705
+ parent_index_block_hash : block3 . block . index_block_hash ,
2706
+ burn_block_time : 1740000000 ,
2707
+ } ) . addTx ( {
2708
+ tx_id : '0x4234' ,
2709
+ fee_rate : 4n ,
2710
+ sender_address : testSendertAddr ,
2711
+ nonce : 4 ,
2712
+ type_id : DbTxTypeId . NakamotoCoinbase ,
2713
+ coinbase_vrf_proof : '0x01' ,
2714
+ } ) . build ( ) ;
2715
+ await db . update ( block4 ) ;
2716
+
2717
+ // Ensure chain_tip reflects latest height for maxHeight filtering
2718
+ const txCountRes = await client < { count : number } [ ] > `
2719
+ SELECT COUNT(*)::integer AS count FROM txs
2720
+ ` ;
2721
+ const txCount = txCountRes [ 0 ] ?. count ?? 0 ;
2722
+ await client `
2723
+ INSERT INTO chain_tip (
2724
+ id,
2725
+ block_height,
2726
+ block_hash,
2727
+ index_block_hash,
2728
+ burn_block_height,
2729
+ block_count,
2730
+ microblock_count,
2731
+ tx_count,
2732
+ tx_count_unanchored
2733
+ ) VALUES (
2734
+ true,
2735
+ ${ block4 . block . block_height } ,
2736
+ ${ block4 . block . block_hash } ,
2737
+ ${ block4 . block . index_block_hash } ,
2738
+ ${ block4 . block . burn_block_height } ,
2739
+ ${ block4 . block . block_height } ,
2740
+ 0,
2741
+ ${ txCount } ,
2742
+ ${ txCount }
2743
+ )
2744
+ ON CONFLICT (id) DO UPDATE SET
2745
+ block_height = EXCLUDED.block_height,
2746
+ block_hash = EXCLUDED.block_hash,
2747
+ index_block_hash = EXCLUDED.index_block_hash,
2748
+ burn_block_height = EXCLUDED.burn_block_height,
2749
+ block_count = EXCLUDED.block_count,
2750
+ tx_count = EXCLUDED.tx_count,
2751
+ tx_count_unanchored = EXCLUDED.tx_count_unanchored
2752
+ ` ;
2753
+
2701
2754
const filterTypes : TransactionType [ ] = [ 'coinbase' , 'poison_microblock' , 'token_transfer' ] ;
2702
2755
const txsReq1 = await supertest ( api . server ) . get (
2703
2756
`/extended/v1/tx?type=${ filterTypes . join ( ',' ) } `
@@ -2706,6 +2759,9 @@ describe('tx tests', () => {
2706
2759
expect ( txsReq1 . body ) . toEqual (
2707
2760
expect . objectContaining ( {
2708
2761
results : [
2762
+ expect . objectContaining ( {
2763
+ tx_id : block4 . txs [ 0 ] . tx . tx_id ,
2764
+ } ) ,
2709
2765
expect . objectContaining ( {
2710
2766
tx_id : block3 . txs [ 0 ] . tx . tx_id ,
2711
2767
} ) ,
0 commit comments