The geometry of the accretion flow around stellar-mass black holes can change on timescales of days to months1,2,3. When a black hole emerges from quiescence (that is, it ‘turns on’ after accreting material from its companion) it has a very hard (high-energy) X-ray spectrum produced by a hot corona4,5 positioned above its accretion disk, and then transitions to a soft (lower-energy) spectrum dominated by emission from the geometrically thin accretion disk, which extends to the innermost stable circular orbit6,7. Much debate persists over how this transition occurs and whether it is driven largely by a reduction in the truncation radius of the disk8,9 or by a reduction in the spatial extent of the corona10,11. Observations of X-ray reverberation lags in supermassive black-hole systems12,13 suggest that the corona is compact and that the disk extends nearly to the central black hole14,15. Observations of stellar-mass black holes, however, reveal equivalent (mass-scaled) reverberation lags that are much larger16, leading to the suggestion that the accretion disk in the hard-X-ray state of stellar-mass black holes is truncated at a few hundreds of gravitational radii from the black hole17,18. Here we report X-ray observations of the black-hole transient MAXI J1820+07019,20. We find that the reverberation time lags between the continuum-emitting corona and the irradiated accretion disk are 6 to 20 times shorter than previously seen. The timescale of the reverberation lags shortens by an order of magnitude over a period of weeks, whereas the shape of the broadened iron K emission line remains remarkably constant. This suggests a reduction in the spatial extent of the corona, rather than a change in the inner edge of the accretion disk.