The geometry of the accretion flow around stellar-mass black holes can change on timescales of days to months 1 , 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 corona 4 , 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 orbit 6 , 7 . Much debate persists over how this transition occurs and whether it is driven largely by a reduction in the truncation radius of the disk 8 , 9 or by a reduction in the spatial extent of the corona 10 , 11 . Observations of X-ray reverberation lags in supermassive black-hole systems 12 , 13 suggest that the corona is compact and that the disk extends nearly to the central black hole 14 , 15 . Observations of stellar-mass black holes, however, reveal equivalent (mass-scaled) reverberation lags that are much larger 16 , 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 hole 17 , 18 . Here we report X-ray observations of the black-hole transient MAXI J1820+070 19 , 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.