Heat the oil in a large saucepan, add the onions and fennel and cook over a gently heat for 25–30 minutes until the onions are very soft.
Add the chestnuts, sugar, vinegar and sherry or marsala to the pan, season well with pepper and stir. Simmer gently, uncovered, for about 1 hour, stirring from time to time, until the chutney has thickened.
Ladle into warm, dry jars. Disperse any air pockets with a skewer or small knife and cover with screw-top lids. Label and leave to mature in a cool, dark place for at least 3 weeks.
To serve, this chutney goes well with rustic bread topped with blue cheese.