RPC: getConfirmedSignaturesForAddress2 only returns confirmed signatures (#11615)
* Add failing test case * Limit to only rooted slots
This commit is contained in:
		@@ -2047,7 +2047,9 @@ impl Blockstore {
 | 
				
			|||||||
                        && key_address == address
 | 
					                        && key_address == address
 | 
				
			||||||
                        && slot >= first_available_block
 | 
					                        && slot >= first_available_block
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        address_signatures.push((slot, signature));
 | 
					                        if self.is_root(slot) {
 | 
				
			||||||
 | 
					                            address_signatures.push((slot, signature));
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                        continue;
 | 
					                        continue;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -2078,7 +2080,9 @@ impl Blockstore {
 | 
				
			|||||||
                    && key_address == address
 | 
					                    && key_address == address
 | 
				
			||||||
                    && slot >= first_available_block
 | 
					                    && slot >= first_available_block
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    address_signatures.push((slot, signature));
 | 
					                    if self.is_root(slot) {
 | 
				
			||||||
 | 
					                        address_signatures.push((slot, signature));
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    continue;
 | 
					                    continue;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -6337,7 +6341,7 @@ pub mod tests {
 | 
				
			|||||||
            let address0 = Pubkey::new_rand();
 | 
					            let address0 = Pubkey::new_rand();
 | 
				
			||||||
            let address1 = Pubkey::new_rand();
 | 
					            let address1 = Pubkey::new_rand();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            for slot in 2..=7 {
 | 
					            for slot in 2..=8 {
 | 
				
			||||||
                let entries = make_slot_entries_with_transaction_addresses(&[
 | 
					                let entries = make_slot_entries_with_transaction_addresses(&[
 | 
				
			||||||
                    address0, address1, address0, address1,
 | 
					                    address0, address1, address0, address1,
 | 
				
			||||||
                ]);
 | 
					                ]);
 | 
				
			||||||
@@ -6363,8 +6367,9 @@ pub mod tests {
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            blockstore.set_roots(&[1, 2, 3, 4, 5, 6, 7]).unwrap();
 | 
					            // Leave one slot unrooted to test only returns confirmed signatures
 | 
				
			||||||
            let highest_confirmed_root = 7;
 | 
					            blockstore.set_roots(&[1, 2, 4, 5, 6, 7, 8]).unwrap();
 | 
				
			||||||
 | 
					            let highest_confirmed_root = 8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Fetch all signatures for address 0 at once...
 | 
					            // Fetch all signatures for address 0 at once...
 | 
				
			||||||
            let all0 = blockstore
 | 
					            let all0 = blockstore
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user