Skip to content

Commit

Permalink
remove default includeEmptyNeurons=false from getNeuron and set test …
Browse files Browse the repository at this point in the history
…to includeEmptyNeurons: false
  • Loading branch information
coskucinkilic committed Oct 10, 2024
1 parent 9573096 commit bbebe15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/nns/src/governance.canister.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,13 +756,13 @@ describe("GovernanceCanister", () => {
const response = await governance.getNeuron({
certified: true,
neuronId,
includeEmptyNeurons: true,
includeEmptyNeurons: false,
});

expect(certifiedService.list_neurons).toBeCalledWith({
neuron_ids: new BigUint64Array([neuronId]),
include_neurons_readable_by_caller: false,
include_empty_neurons_readable_by_caller: [true],
include_empty_neurons_readable_by_caller: [false],
include_public_neurons_in_full_neurons: [],
});

Expand Down
8 changes: 3 additions & 5 deletions packages/nns/src/governance.canister.ts
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ export class GovernanceCanister {
public getNeuron = async ({
certified = true,
neuronId,
includeEmptyNeurons = false,
includeEmptyNeurons,
}: {
certified: boolean;
neuronId: NeuronId;
Expand All @@ -985,13 +985,11 @@ export class GovernanceCanister {
// The governance canister exposes two functions "get_neuron_info" and "get_full_neuron" that could probably be used to fetch the neuron details too.
// However historically this function has been resolved with a single call "list_neurons".

//Visibility is not provided by old oldListNeuronsCertifiedService, and we pass include empty neurons to get correct visibility
//Visibility is not provided by oldListNeuronsCertifiedService, and we pass include empty neurons to have option to use the certifiedService
const [neuron]: NeuronInfo[] = await this.listNeurons({
certified,
neuronIds: [neuronId],
includeEmptyNeurons: includeEmptyNeurons
? includeEmptyNeurons
: undefined,
includeEmptyNeurons,
});

return neuron;
Expand Down

0 comments on commit bbebe15

Please sign in to comment.